dao

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableName = "user"
)

user 数据表

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

type Dao struct {
	ORM *gorm.DB
	DB  *storer.DB
}

Dao 对象

func New

func New(cfg *config.Config) *Dao

New 实例化

func (*Dao) Count

func (dao *Dao) Count(tableName string, count *int, query *model.QueryParam) bool

Count 统计某条件字段的条目数

func (*Dao) Create

func (dao *Dao) Create(tableName string, data interface{}) bool

Create 数据添加

func (*Dao) CreateUser

func (d *Dao) CreateUser(data *model.User) bool

CreateUser 创建用户

func (*Dao) Delete

func (dao *Dao) Delete(tableName string, data interface{}, query *model.QueryParam) bool

Delete 删除数据

func (*Dao) DeleteById

func (dao *Dao) DeleteById(tableName string, data interface{}) bool

DeleteById 更加ID删除数据

func (*Dao) DeleteUser

func (d *Dao) DeleteUser(id uint64) bool

DeleteUser 删除用户

func (*Dao) FindById

func (dao *Dao) FindById(tableName string, data interface{}, id interface{}) bool

FindById 根据ID查询数据

func (*Dao) FindMulti

func (dao *Dao) FindMulti(tableName string, data interface{}, query *model.QueryParam) bool

FindMulti 数据复合查询

func (*Dao) FindOne

func (dao *Dao) FindOne(tableName string, data interface{}, query *model.QueryParam) bool

FindOne 根据某一字段查询数据

func (*Dao) FindUser

func (d *Dao) FindUser(id uint64) (*model.User, bool)

FindUser 根据用户ID, 获取用户数据

func (*Dao) FindUserOne

func (d *Dao) FindUserOne(query *model.QueryParam) (*model.User, bool)

FindUserOne 根据用户某一条件,获取用户数据

func (*Dao) FindUserTotal

func (d *Dao) FindUserTotal(query *model.QueryParam) (int, bool)

FindUserTotal 根据用户某一条件,统计用户数据条数

func (*Dao) ListUser

func (d *Dao) ListUser(query *model.QueryParam) ([]*model.User, bool)

ListUser 获取用户列表

func (*Dao) Update

func (dao *Dao) Update(tableName string, data interface{}, query *model.QueryParam) bool

Update 更新数据

func (*Dao) UpdateUser

func (d *Dao) UpdateUser(id uint64, data map[string]interface{}) bool

UpdateUser 更新用户

Jump to

Keyboard shortcuts

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