biz

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOKEN_KEY = "GOCODEGEN20220808"
)

Variables

View Source
var (
	SysRoleService = SysRoleServiceType{}
	SysRoleConn    = query.Use(dal.CreateDbConn("SysRole"))
	SysRoleDao     = SysRoleConn.SysRole
)
View Source
var (
	TestCatService = TestCatServiceType{}
	TestCatConn    = query.Use(dal.CreateDbConn("TestCat"))
	TestCatDao     = TestCatConn.TestCat
)

Functions

func CreatePasswordHash

func CreatePasswordHash(password string) (string, error)

func CreateToken

func CreateToken(tokenPairs map[string]interface{}) (string, error)

func DecodeToken

func DecodeToken(tokenStr string) (map[string]interface{}, error)

func IsPasswordRight

func IsPasswordRight(passwordHashInDb string, passwordLogin string) bool

passwordHashInDb: pasword hash str stored in db passwordLogin: password from login input

Types

type SysRoleServiceType

type SysRoleServiceType struct {
}

func (*SysRoleServiceType) Clean

func (c *SysRoleServiceType) Clean() (int64, error)

清除已软删除的记录,成功返回影响的行数, 有deleted字段时才有该方法

func (*SysRoleServiceType) Create

func (c *SysRoleServiceType) Create(model *model.SysRole) (*model.SysRole, error)

创建一个,成功返回的对象有记录ID

func (*SysRoleServiceType) CreateBatch

func (c *SysRoleServiceType) CreateBatch(models []*model.SysRole, batchSize int) ([]*model.SysRole, error)

批量创建,成功返回成功插入的行数

func (*SysRoleServiceType) Delete

func (c *SysRoleServiceType) Delete(ids []int64) (int64, error)

硬删除记录,成功返回影响的行数

func (*SysRoleServiceType) GetOrderByExpr

func (c *SysRoleServiceType) GetOrderByExpr(orderBy string) ([]field.Expr, error)

解析orderby 字符串为表达式,orderBy格式: "id desc,name desc"

func (*SysRoleServiceType) QueryAll

func (c *SysRoleServiceType) QueryAll(wheres []field.Expr, orderBys []field.Expr, page int, pageSize int) ([]*model.SysRole, int64, error)

查询所有,limits<0 时无限制

func (*SysRoleServiceType) QueryById

func (c *SysRoleServiceType) QueryById(id int64) (*model.SysRole, error)

按id查询一个

func (*SysRoleServiceType) SoftDelete

func (c *SysRoleServiceType) SoftDelete(ids []int64) (int64, error)

软删除,设置deleted=1,成功返回影响的行数, 有deleted字段时才有该方法

func (*SysRoleServiceType) Update

func (c *SysRoleServiceType) Update(model *model.SysRole) (int64, error)

更新一个,成功返回影响的行数

func (*SysRoleServiceType) UpdateBatch

func (c *SysRoleServiceType) UpdateBatch(models []*model.SysRole) (int64, error)

批量更新,成功返回成功的行数

func (*SysRoleServiceType) UpdateColumns

func (c *SysRoleServiceType) UpdateColumns(whereExpr field.Expr, columns map[string]interface{}) (int64, error)

按条件更新一批指定的字段,成功返回影响的行数

type TestCatServiceType

type TestCatServiceType struct {
}

func (*TestCatServiceType) Create

func (c *TestCatServiceType) Create(model *model.TestCat) (*model.TestCat, error)

创建一个,成功返回的对象有记录ID

func (*TestCatServiceType) CreateBatch

func (c *TestCatServiceType) CreateBatch(models []*model.TestCat, batchSize int) ([]*model.TestCat, error)

批量创建,成功返回成功插入的行数

func (*TestCatServiceType) Delete

func (c *TestCatServiceType) Delete(ids []int64) (int64, error)

硬删除记录,成功返回影响的行数

func (*TestCatServiceType) GetOrderByExpr

func (c *TestCatServiceType) GetOrderByExpr(orderBy string) ([]field.Expr, error)

解析orderby 字符串为表达式,orderBy格式: "id desc,name desc"

func (*TestCatServiceType) QueryAll

func (c *TestCatServiceType) QueryAll(wheres []field.Expr, orderBys []field.Expr, page int, pageSize int) ([]*model.TestCat, int64, error)

查询所有,limits<0 时无限制

func (*TestCatServiceType) QueryById

func (c *TestCatServiceType) QueryById(id int64) (*model.TestCat, error)

按id查询一个

func (*TestCatServiceType) Update

func (c *TestCatServiceType) Update(model *model.TestCat) (int64, error)

更新一个,成功返回影响的行数

func (*TestCatServiceType) UpdateBatch

func (c *TestCatServiceType) UpdateBatch(models []*model.TestCat) (int64, error)

批量更新,成功返回成功的行数

func (*TestCatServiceType) UpdateColumns

func (c *TestCatServiceType) UpdateColumns(whereExpr field.Expr, columns map[string]interface{}) (int64, error)

按条件更新一批指定的字段,成功返回影响的行数

Jump to

Keyboard shortcuts

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