gorm

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddExtranetIp

func AddExtranetIp(ip string)

func AddGroupTodoItem

func AddGroupTodoItem(content string, sort int, account string, group string)

func AddPhoto

func AddPhoto(image string, account string)

func AddTodoItem

func AddTodoItem(content string, sort int, account string)

func CompleteGroupTodoItem

func CompleteGroupTodoItem(id int)

func CompleteTodoItem

func CompleteTodoItem(id int)

func DeleteGroupTodoItem

func DeleteGroupTodoItem(id int)

func DeleteTodoItem

func DeleteTodoItem(id int)

func ExistExtranetIp

func ExistExtranetIp(ip string) bool

func GetDB

func GetDB() *gorm.DB

获取gorm db对象,其他包需要执行数据库查询的时候,只要通过tools.getDB()获取db对象即可。 不用担心协程并发使用同样的db对象会共用同一个连接,db对象在调用他的方法的时候会从数据库连接池中获取新的连接

func InitDB

func InitDB()

func Operate

func Operate()

func SelectPhotos

func SelectPhotos(account string, day time.Time) []string

func SelectTodayPhotos

func SelectTodayPhotos(account string) []string

Types

type ExtranetIp

type ExtranetIp struct {
	gorm.Model
	IP string `gorm:"column:IP;type:varchar(100);unique"`
}

type GroupTodoItem

type GroupTodoItem struct {
	gorm.Model
	Group     string `gorm:"column:group;type:varchar(255);index:index_group"`
	Account   string `gorm:"column:account;type:varchar(255);index:index_account"`
	Content   string `gorm:"column:content;type:varchar(255)"`
	Sort      int    `gorm:"column:sort;type:int(11);index:index_sort"`
	Completed bool   `gorm:"column:completed;type:tinyint(1)"`
}

func SelectGroupTodoList

func SelectGroupTodoList(group string) []GroupTodoItem

type Photo

type Photo struct {
	gorm.Model
	Image string `gorm:"column:image;type:varchar(255)"`
	//Base64Image string
	Account string `gorm:"column:Account;type:varchar(255);index:index_account"`
}

type Product

type Product struct {
	gorm.Model
	Title string
	Code  string
	Price uint
}

type TodoItem

type TodoItem struct {
	gorm.Model
	Account   string `gorm:"column:account;type:varchar(255);index:index_account"`
	Content   string `gorm:"column:content;type:varchar(255)"`
	Sort      int    `gorm:"column:sort;type:int(11);index:index_sort"`
	Completed bool   `gorm:"column:completed;type:tinyint(1)"`
}

func SelectTodoList

func SelectTodoList(account string) []TodoItem

Jump to

Keyboard shortcuts

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