db

package
v0.0.0-...-cd92494 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func AddUer

func AddUer(user_name string, user_password string) (user_id string, err error)

添加用户

func GetBinStatuses

func GetBinStatuses(user_id string) (map[string]int32, error)

用户查询垃圾桶实时状态

func GetBinsInfo

func GetBinsInfo(user_id string) ([]pb.BinInfoItem, int, error)

用户查询垃圾桶实时信息

func GetUserScores

func GetUserScores() (map[string]int32, error)

查询所有用户积分

func GetWasteCount

func GetWasteCount(user_id string) (int, map[int]int, error)

查询用户垃圾统计信息

func GetWeekWasteCount

func GetWeekWasteCount(user_id string) (int, map[int]int, error)

查询最近一周用户垃圾数据统计信息

func SearchUserForLogin

func SearchUserForLogin(user_id string, user_password string) (bool, error)

登录验证用户

func UpdateUser

func UpdateUser(user_id string, user_name string, user_password string) error

修改用户 (密码、用户名)

func UpdateUserScore

func UpdateUserScore(user_id string, score int) error

修改用户积分

Types

type Bin

type Bin struct {
	Bin_id     int     `gorm:"column:bin_id;primary_key;AUTO_INCREMENT"`
	Status     int     `gorm:"column:status;"`
	Start_time int     `gorm:"column:start_time;"`
	Ip_address string  `gorm:"column:ip_address;"`
	Angel      float32 `gorm:"column:angel;"`
	Temp       float32 `gorm:"column:temp;"`
	Comments   string  `gorm:"column:comment;"`
}

type BinWasteRelation

type BinWasteRelation struct {
	Id       int `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	Bin_id   int `gorm:"column:bin_id;"`
	Waste_id int `gorm:"column:waste_id;"`
}

type DBconfig

type DBconfig struct {
	User     string
	Password string
	Host     string
	Port     string
	DBname   string
}

type User

type User struct {
	User_id   string `gorm:"column:user_id;primary_key;AUTO_INCREMENT"`
	User_name string `gorm:"column:name;primary_key;"`
	Password  string `gorm:"column:password;"`
	Score     int    `gorm:"column:score;"`
}

func SearchUser

func SearchUser(user_id string) (*User, error)

查询用户

type UserBinRelation

type UserBinRelation struct {
	Id      int `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	Bin_id  int `gorm:"column:bin_id;"`
	User_id int `gorm:"column:user_id;"`
}

type Waste

type Waste struct {
	Waste_id    int    `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	Bin_id      int    `gorm:"column:bin_id;"`
	Waste_name  string `gorm:"column:waste_name;"`
	Create_time string `gorm:"column:create_time;"`
	Type_id     int    `gorm:"column:type_id;"`
	Image       []byte `gorm:"column:image;"`
}

Jump to

Keyboard shortcuts

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