dao

package
Version: 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: 1

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 Find

func Find(collection *mgo.Collection, query interface{}, vessel *Vessel) error

func FindAll

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

func Insert

func Insert(collection *mgo.Collection, vessel *Vessel) error

Types

type Vessel

type Vessel struct {
	Id        bson.ObjectId `json:"id,omitempty"  bson:"_id,omitempty"`
	Capacity  int32         `json:"capacity,omitempty" bson:"capacity,omitempty"`
	MaxWeight int32         `json:"max_weight,omitempty" bson:"max_weight,omitempty"`
	Name      string        `json:"name,omitempty" bson:"name,omitempty"`
	Available bool          `json:"available,omitempty" bson:"available,omitempty"`
	OwerId    string        `json:"ower_id,omitempty" bson:"ower_id,omitempty"`
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL