mongo

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

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

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAllSelected

func FindAllSelected(filter bson.M, dbName string, tableName string) []bson.M

func FindByPipe

func FindByPipe(pipe []bson.M, dbName string, tableName string) []bson.M

func FindOneSelected

func FindOneSelected(filter bson.M, dbName string, tableName string) bson.M

func Setup

func Setup()

func UpdateAll

func UpdateAll(filter bson.M, update bson.M, dbName string, tableName string) int64

Types

type AccessToken

type AccessToken struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	Name       string             `json:"name" bson:"name"`
	Token      string             `json:"token" bson:"token"`
	CreateTime time.Time          `json:"createTime" bson:"createTime"` //创建时间
	UpdateTime time.Time          `json:"updateTime" bson:"updateTime"` //更新时间
}

func (AccessToken) CreateRow

func (d AccessToken) CreateRow() interface{}

func (AccessToken) FindAll

func (d AccessToken) FindAll(filter bson.M) []bson.M

func (AccessToken) FindOne

func (d AccessToken) FindOne(filter bson.M) bson.M

func (AccessToken) UpdateAll

func (d AccessToken) UpdateAll(filter, update bson.M) int64

type DishLib

type DishLib struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	Name       string             `json:"name" bson:"name"`             //菜品名称
	Supplier   string             `json:"supplier" bson:"supplier"`     //供应商
	CreateTime time.Time          `json:"createTime" bson:"createTime"` //创建时间
}

func (DishLib) CreateRow

func (d DishLib) CreateRow() interface{}

func (DishLib) FindAll

func (d DishLib) FindAll(filter bson.M) []bson.M

func (DishLib) FindOne

func (d DishLib) FindOne(filter bson.M) bson.M

func (DishLib) UpdateAll

func (d DishLib) UpdateAll(filter, update bson.M) int64

type DishesMongo

type DishesMongo struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	Name       string             `json:"name" bson:"name"` //菜品名称
	Dsc        string             `json:"dsc" bson:"dsc"`
	Supplier   string             `json:"supplier" bson:"supplier"`     //供应商
	TypeA      int32              `json:"typeA" bson:"typeA"`           //1-lunch 2-dinner
	TypeB      int32              `json:"typeB" bson:"typeB"`           //1-自助餐 2-简餐
	MealDay    string             `json:"mealDay"  bson:"mealDay"`      //用餐日
	MealNum    int                `json:"mealNum" bson:"mealNum"`       //菜品编号
	CreateTime time.Time          `json:"createTime" bson:"createTime"` //创建时间
	UpdateTime time.Time          `json:"updateTime" bson:"updateTime"` //创建时间
	Status     int32              `json:"status" bson:"status"`         //0-开启 1-关闭
}

func (DishesMongo) CreateRow

func (d DishesMongo) CreateRow() interface{}

func (DishesMongo) FindAll

func (d DishesMongo) FindAll(filter bson.M) []bson.M

func (DishesMongo) GetOptionalBuffet

func (d DishesMongo) GetOptionalBuffet() []bson.M

可选的自助餐

type MongoUtils

type MongoUtils struct {
	Con *mongo.Client
	Db  *mongo.Database
}

func (*MongoUtils) FindMore

func (o *MongoUtils) FindMore(col string, filter bson.M) ([]bson.M, error)

func (*MongoUtils) FindMoreByPipe

func (o *MongoUtils) FindMoreByPipe(col string, pipe []bson.M) ([]bson.M, error)

func (*MongoUtils) FindOne

func (o *MongoUtils) FindOne(col string, filter bson.M) (bson.M, error)

func (*MongoUtils) OpenConn

func (o *MongoUtils) OpenConn() (con *mongo.Client)

func (*MongoUtils) SetDb

func (o *MongoUtils) SetDb(db string)

func (*MongoUtils) UpdateAll

func (o *MongoUtils) UpdateAll(col string, filter bson.M, update bson.M) (int64, error)

type Switches

type Switches struct {
	ID           primitive.ObjectID `bson:"_id,omitempty"`
	Name         string             `json:"name" bson:"name"`
	Enable       int                `json:"enable" bson:"enable"`
	StartMealDay string             `json:"startMealDay" bson:"startMealDay"`
	EndMealDay   string             `json:"endMealDay" bson:"endMealDay"`
	CreateTime   time.Time          `json:"createTime" bson:"createTime"` //创建时间
	UpdateTime   time.Time          `json:"updateTime" bson:"updateTime"` //更新时间
}

func (Switches) CreateRow

func (d Switches) CreateRow() interface{}

func (Switches) FindAll

func (d Switches) FindAll(filter bson.M) []bson.M

func (Switches) FindOne

func (d Switches) FindOne(filter bson.M) bson.M

func (Switches) UpdateAll

func (d Switches) UpdateAll(filter, update bson.M) int64

type UserDishesMongo

type UserDishesMongo struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	Uid       string             `json:"uid" bson:"uid"`               //用户id
	DishId    string             `json:"dishId" bson:"dishId"`         //菜单id
	Name      string             `json:"name" bson:"name"`             //菜品名称
	Dsc       string             `json:"dsc" bson:"dsc"`               //菜品明细
	Supplier  string             `json:"supplier" bson:"supplier"`     //供应商
	TypeA     int32              `json:"typeA" bson:"typeA"`           //1-lunch 2-dinner 3-breakfast
	MealDay   string             `json:"mealDay"  bson:"mealDay"`      //用餐日
	MealNum   int32              `json:"mealNum" bson:"mealNum"`       //菜品编号
	OrderTime time.Time          `json:"updateTime" bson:"updateTime"` //订餐时间
	Status    int32              `json:"status" bson:"status"`         //0-订餐 1-取餐
	BadEval   bool               `json:"badEval" bson:"badEval"`       //差评
}

func (UserDishesMongo) CreateRow

func (d UserDishesMongo) CreateRow() interface{}

func (UserDishesMongo) FindAll

func (d UserDishesMongo) FindAll(filter bson.M) []bson.M

func (UserDishesMongo) FindOne

func (d UserDishesMongo) FindOne(filter bson.M) bson.M

func (UserDishesMongo) GetTotalByOrdered

func (d UserDishesMongo) GetTotalByOrdered() []bson.M

func (UserDishesMongo) GetUserDishesByOrdered

func (d UserDishesMongo) GetUserDishesByOrdered(uid string) []bson.M

可选的午餐和晚餐

func (UserDishesMongo) UpdateAll

func (d UserDishesMongo) UpdateAll(filter, update bson.M) int64

type UserMongo

type UserMongo struct {
	ID         primitive.ObjectID `bson:"_id,omitempty"`
	Name       string             `json:"name" bson:"name"`
	Email      string             `json:"email" bson:"email"`
	PassWord   string             `json:"password" bson:"password"` //登录密码
	Type       int                `json:"type" bson:"type"`         //1-管理员 2-外部用户 3-微信用户
	Depart     string             `json:"depart" bson:"depart"`
	CreateTime time.Time          `json:"createTime" bson:"createTime"` //创建时间
	Unique     string             `json:"unique" bson:"unique"`         //导入用户填邮箱,微信用户填userid
}

func (UserMongo) CreateRow

func (d UserMongo) CreateRow() interface{}

func (UserMongo) FindOne

func (d UserMongo) FindOne(filter bson.M) bson.M

func (UserMongo) ResetPassWord

func (d UserMongo) ResetPassWord(uid string) int64

func (UserMongo) UpdateAll

func (d UserMongo) UpdateAll(filter, update bson.M) int64

Jump to

Keyboard shortcuts

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