model

package
v0.0.0-...-54bb499 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DB_NAME        = "MicroServicePractice"
	CON_COLLECTION = "consignments"
)

Variables

This section is empty.

Functions

func Consignment2PBConsignment

func Consignment2PBConsignment(con *dao.Consignment) pb.Consignment

func InterfaceToPB

func InterfaceToPB(from interface{}, pb interface{}) error

func JSON2Map

func JSON2Map(jsonByte []byte) (map[string]interface{}, error)

func PB2JSON

func PB2JSON(pb proto.Message) ([]byte, error)

func PB2Map

func PB2Map(pb proto.Message) (map[string]interface{}, error)

func PBConsignment2Consignment

func PBConsignment2Consignment(con *pb.Consignment) dao.Consignment

Types

type ConsignmentRepository

type ConsignmentRepository struct {
	// contains filtered or unexported fields
}

func GetConsignmentRepository

func GetConsignmentRepository(session *mgo.Session) *ConsignmentRepository

func (*ConsignmentRepository) Close

func (repo *ConsignmentRepository) Close()

关闭连接

func (*ConsignmentRepository) Create

func (repo *ConsignmentRepository) Create(con *pb.Consignment) error

接口实现

func (*ConsignmentRepository) GetAll

func (repo *ConsignmentRepository) GetAll() ([]*pb.Consignment, error)

获取全部数据

type Repository

type Repository interface {
	Create(*pb.Consignment) error
	GetAll() ([]*pb.Consignment, error)
	Close()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL