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: 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{}, user *User) error

func FindAll

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

func Insert

func Insert(collection *mgo.Collection, user *User) error

Types

type User

type User struct {
	Id       bson.ObjectId `json:"id,omitempty" bson:"_id,omitempty"`
	Name     string        `json:"name,omitempty" bson:"name,omitempty"`
	Company  string        `json:"company,omitempty" bson:"company,omitempty"`
	Email    string        `json:"email,omitempty" bson:"email,omitempty"`
	Password string        `json:"password,omitempty" bson:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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