model

package
v0.0.0-...-83d3498 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = sqlx.ErrNotFound

Functions

This section is empty.

Types

type APIDeleteMultiple

type APIDeleteMultiple struct {
	ID     uint64
	API    string
	Method string
}

type Api

type Api struct {
	Id       uint64 `db:"id"`
	Api      string `db:"api"`      // api接口
	Group    string `db:"group"`    // api分组
	Describe string `db:"describe"` // api描述信息
	Method   string `db:"method"`   // 方法
}

type ApiModel

type ApiModel interface {
	Trans(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error
	Total_NC(ctx context.Context, r *PagingAPIList) (int64, error)
	FindAll_NC(ctx context.Context) ([]Api, error)
	FindPaging_NC(ctx context.Context, r *PagingAPIList) ([]Api, error)

	TransUpdate(ctx context.Context, session sqlx.Session, newData *Api) error
	TransDeleteMultiple(ctx context.Context, session sqlx.Session, deleteMul []APIDeleteMultiple) error
	// contains filtered or unexported methods
}

ApiModel is an interface to be customized, add more methods here, and implement the added methods in customApiModel.

func NewApiModel

func NewApiModel(conn sqlx.SqlConn, c cache.CacheConf) ApiModel

NewApiModel returns a model for the database table.

type CasbinRule

type CasbinRule struct {
	Id    uint64 `db:"id"`
	PType string `db:"p_type"`
	V0    string `db:"v0"`
	V1    string `db:"v1"`
	V2    string `db:"v2"`
	V3    string `db:"v3"`
	V4    string `db:"v4"`
	V5    string `db:"v5"`
}

type CasbinRuleModel

type CasbinRuleModel interface {
	TransUpdateV2V3(ctx context.Context, session sqlx.Session, newdata *Api, oldData *Api) error
	TransDeleteMultiple(ctx context.Context, session sqlx.Session, deleteMul []APIDeleteMultiple) error
	TransDeleteByV0(ctx context.Context, session sqlx.Session, roleid uint64) error
	// contains filtered or unexported methods
}

CasbinRuleModel is an interface to be customized, add more methods here, and implement the added methods in customCasbinRuleModel.

func NewCasbinRuleModel

func NewCasbinRuleModel(conn sqlx.SqlConn) CasbinRuleModel

NewCasbinRuleModel returns a model for the database table.

type Menu struct {
	Id         uint64       `db:"id"`
	ParentId   uint64       `db:"parent_id"` // 父菜单ID
	Name       string       `db:"name"`      // 路由name
	Path       string       `db:"path"`      // 路由path
	Component  string       `db:"component"` // 对应前端文件路径
	Title      string       `db:"title"`     // 附加属性
	Icon       string       `db:"icon"`      // 附加属性
	Sort       int64        `db:"sort"`      // 排序
	Hidden     int64        `db:"hidden"`    // 是否隐藏 0 false/1 true
	CreateTime time.Time    `db:"create_time"`
	UpdateTime time.Time    `db:"update_time"`
	DeleteTime sql.NullTime `db:"delete_time"`
}
type MenuModel interface {
	Trans(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error
	FindAll_NC(ctx context.Context) ([]Menu, error)
	FindByParentID_NC(ctx context.Context, parentid uint64) ([]Menu, error)

	TransDelete(ctx context.Context, session sqlx.Session, id uint64) error
	// contains filtered or unexported methods
}

MenuModel is an interface to be customized, add more methods here, and implement the added methods in customMenuModel.

func NewMenuModel

func NewMenuModel(conn sqlx.SqlConn, c cache.CacheConf) MenuModel

NewMenuModel returns a model for the database table.

type Option

type Option func(o *Options)

func WithExpiry

func WithExpiry(expiry time.Duration) Option

func WithNotFoundExpiry

func WithNotFoundExpiry(expiry time.Duration) Option

type Options

type Options struct {
	Expiry         time.Duration
	NotFoundExpiry time.Duration
}

type PagingAPIList

type PagingAPIList struct {
	Page     int64
	PageSize int64
	OrderKey string
	Order    string

	Api      string
	Describe string
	Group    string
	Method   string
}

type PagingUserList

type PagingUserList struct {
	Page     int64
	PageSize int64
	NameX    string
}

type Role

type Role struct {
	Id         uint64       `db:"id"`
	Role       string       `db:"role"` // 用户角色
	Name       string       `db:"name"`
	CreateBy   string       `db:"create_by"`
	CreateTime time.Time    `db:"create_time"`
	UpdateBy   string       `db:"update_by"`
	UpdateTime time.Time    `db:"update_time"`
	DeleteBy   string       `db:"delete_by"`
	DeleteTime sql.NullTime `db:"delete_time"`
}

type RoleMenu

type RoleMenu struct {
	Id     uint64 `db:"id"`
	MenuId uint64 `db:"menu_id"`
	RoleId uint64 `db:"role_id"`
}

type RoleMenuModel

type RoleMenuModel interface {
	Trans(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error
	FindByMenuID_NC(ctx context.Context, menuid uint64) ([]RoleMenu, error)
	FindByRoleID(ctx context.Context, redis *redis.Redis, roleID uint64) ([]RoleMenu, error)

	TransDeleteByMenuId(ctx context.Context, session sqlx.Session, menuid uint64) error
	TransDeleteByRoleId(ctx context.Context, session sqlx.Session, roleid uint64) error

	TransReplaceByMenus(ctx context.Context, session sqlx.Session, roleid uint64, menuIDs []uint64) error
}

RoleMenuModel is an interface to be customized, add more methods here, and implement the added methods in customRoleMenuModel.

func NewRoleMenuModel

func NewRoleMenuModel(conn sqlx.SqlConn, c cache.CacheConf) RoleMenuModel

NewRoleMenuModel returns a model for the database table.

type RoleModel

type RoleModel interface {
	FindAll_NC(ctx context.Context) ([]Role, error)
	Trans(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error

	TransDelete(ctx context.Context, session sqlx.Session, id uint64) error
	UpdateDeleteColumn(ctx context.Context, roleid uint64, deleteby string, deletetime sql.NullTime) error
	// contains filtered or unexported methods
}

RoleModel is an interface to be customized, add more methods here, and implement the added methods in customRoleModel.

func NewRoleModel

func NewRoleModel(conn sqlx.SqlConn, c cache.CacheConf) RoleModel

NewRoleModel returns a model for the database table.

type User

type User struct {
	Id          uint64        `db:"id"`
	Name        string        `db:"name"`         // 用户名
	NickName    string        `db:"nick_name"`    // 中文名
	Password    string        `db:"password"`     // 密码
	Type        int64         `db:"type"`         // 账户类型 0-本地用户 1-ldap用户
	Email       string        `db:"email"`        // 邮箱
	Phone       string        `db:"phone"`        // 电话
	Department  string        `db:"department"`   // 部门
	Position    string        `db:"position"`     // 职位
	CurrentRole uint64        `db:"current_role"` // 当前用户角色
	CreateBy    string        `db:"create_by"`    // 创建人
	CreateTime  time.Time     `db:"create_time"`  // 创建时间
	UpdateBy    string        `db:"update_by"`    // 更新人
	UpdateTime  time.Time     `db:"update_time"`  // 更新时间
	DeleteBy    string        `db:"delete_by"`    // 删除人
	DeleteTime  sql.NullTime  `db:"delete_time"`  // 删除时间
	PageSetId   sql.NullInt64 `db:"page_set_id"`
}

type UserMenuParams

type UserMenuParams struct {
	Id     uint64 `db:"id"`
	UserId uint64 `db:"user_id"`
	MenuId uint64 `db:"menu_id"`
	Type   string `db:"type"`
	Key    string `db:"key"`
	Value  string `db:"value"`
}

type UserMenuParamsModel

type UserMenuParamsModel interface {
	FindAll_NC(ctx context.Context) ([]UserMenuParams, error)
	Trans(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error

	FindByUserID(ctx context.Context, redis *redis.Redis, userid uint64) ([]UserMenuParams, error)

	InsertMultiple(ctx context.Context, data []*UserMenuParams) (sql.Result, error)

	DeleteByMenuID(ctx context.Context, menuid uint64) error

	TransDeleteByMenuID(ctx context.Context, session sqlx.Session, menuid uint64) error
	TransDeleteByUserID(ctx context.Context, session sqlx.Session, userid uint64) error
	TransInsertMultiple(ctx context.Context, session sqlx.Session, data []*UserMenuParams) (sql.Result, error)
	TransDeleteNotINANDMenuID(ctx context.Context, session sqlx.Session, data []*UserMenuParams, menuid uint64) error
	TransUpdate(ctx context.Context, session sqlx.Session, data *UserMenuParams) error
}

UserMenuParamsModel is an interface to be customized, add more methods here, and implement the added methods in customUserMenuParamsModel.

func NewUserMenuParamsModel

func NewUserMenuParamsModel(conn sqlx.SqlConn, c cache.CacheConf) UserMenuParamsModel

NewUserMenuParamsModel returns a model for the database table.

type UserModel

type UserModel interface {
	TransCtx(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error
	FindPagingList_NC(ctx context.Context, r *PagingUserList) ([]User, error)
	FindAll_NC(ctx context.Context) ([]User, error)
	Total_NC(ctx context.Context) (int64, error)

	FindOneByNameWHEREDeleteTimeISNULL(ctx context.Context, name string) (*User, error)

	UpdateUserPassword(ctx context.Context, id uint64, pass string) error
	UpdateDeleteColumn(ctx context.Context, userid uint64, deleteby string, deletetime sql.NullTime) error
	UpdateWithOutPassword(ctx context.Context, newData *User) error
	UpdateCurrentRoleColumn(ctx context.Context, userid uint64, roleid uint64) error

	TransInsert(ctx context.Context, session sqlx.Session, data *User) (sql.Result, error)
	TransDelete(ctx context.Context, session sqlx.Session, id uint64) error
	// contains filtered or unexported methods
}

UserModel is an interface to be customized, add more methods here, and implement the added methods in customUserModel.

func NewUserModel

func NewUserModel(conn sqlx.SqlConn, c cache.CacheConf) UserModel

NewUserModel returns a model for the database table.

type UserPageSet

type UserPageSet struct {
	Id              uint64 `db:"id"`
	UserId          uint64 `db:"user_id"`
	Avatar          string `db:"avatar"`            // 头像
	DefaultRouter   string `db:"default_router"`    // 默认路由
	SideMode        string `db:"side_mode"`         // side颜色
	TextColor       string `db:"text_color"`        // 文本颜色
	ActiveTextColor string `db:"active_text_color"` // 选中路由文本颜色
}

type UserPageSetModel

type UserPageSetModel interface {
	TransDeleteByUserID(ctx context.Context, session sqlx.Session, userid uint64) error
	// contains filtered or unexported methods
}

UserPageSetModel is an interface to be customized, add more methods here, and implement the added methods in customUserPageSetModel.

func NewUserPageSetModel

func NewUserPageSetModel(conn sqlx.SqlConn, c cache.CacheConf) UserPageSetModel

NewUserPageSetModel returns a model for the database table.

type UserRole

type UserRole struct {
	Id     uint64 `db:"id"`
	UserId uint64 `db:"user_id"`
	RoleId uint64 `db:"role_id"`
}

type UserRoleModel

type UserRoleModel interface {
	TransCtx(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error

	FindByUserIDWhereRoleNotDel(ctx context.Context, redis *redis.Redis, userID uint64) ([]UserRole, error)

	TranInsertUserIDRoleIDs(ctx context.Context, session sqlx.Session, userID uint64, role_id_s []uint64) (sql.Result, error)
	TransDeleteByUserID(ctx context.Context, session sqlx.Session, userID uint64) error
	TransDeleteByRoleID(ctx context.Context, session sqlx.Session, roleID uint64) error
}

UserRoleModel is an interface to be customized, add more methods here, and implement the added methods in customUserRoleModel.

func NewUserRoleModel

func NewUserRoleModel(conn sqlx.SqlConn, c cache.CacheConf) UserRoleModel

NewUserRoleModel returns a model for the database table.

Jump to

Keyboard shortcuts

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