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 AddBin

func AddBin(user_id int) (int, error)

添加新垃圾桶信息 bin & bin_user_relations

func AddWaste

func AddWaste(waste_name string, bin_id string, type_id int, image []byte) error

添加垃圾信息 wastes

func SearchWasteType

func SearchWasteType(waste_name string) (int, error)

查询waste的type_id

func UpdateBinStatus

func UpdateBinStatus(bin_id int, status_id int, angel float32, term float32) error

修改垃圾桶状态 bins

func UpdateUserScore

func UpdateUserScore(user_id int, score int) error

修改用户积分 users

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;"`
}

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 int    `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