dao

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: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_HOST = "127.0.0.1"
)

Variables

This section is empty.

Functions

func CreateSession

func CreateSession(host string, port int32) (*mgo.Session, error)

CreateSession create the session of mongo

func CreateSessionWithAuth

func CreateSessionWithAuth(host string, port int32, user, password, adminDBName string) (*mgo.Session, error)

func FindAll

func FindAll(collection *mgo.Collection, query interface{}, consignments *[]*Consignment) error

func Insert

func Insert(collection *mgo.Collection, consignment *Consignment) error

Types

type Consignment

type Consignment struct {
	Id          bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`
	Description string        `json:"description,omitempty" bson:"description,omitempty"`
	Weight      int32         `json:"weight,omitempty" bson:"weight,omitempty"`
	Containers  []*Container  `json:"containers,omitempty" bson:"containers,omitempty"`
	VesselId    string        `json:"vessel_id,omitempty" bson:"vessel_id,omitempty"`
}

type Container

type Container struct {
	Id         string `json:"id,omitempty" bson:"id,omitempty"`
	CustomerId string `json:"customer_id,omitempty" bson:"customer_id,omitempty"`
	Origin     string `json:"origin,omitempty" bson:"origin,omitempty"`
	UserId     string `json:"user_id,omitempty" bson:"user_id,omitempty"`
}

Jump to

Keyboard shortcuts

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