mysql

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicate = errors.New("sql: duplicate key")
View Source
var ErrNotFound = sqlx.ErrNotFound

Functions

This section is empty.

Types

type ApiFilter added in v0.3.1

type ApiFilter struct {
	Page   *def.PageInfo
	Route  string
	Method int64
	Group  string
	Name   string
}

func (*ApiFilter) FmtSqlApi added in v0.3.1

func (g *ApiFilter) FmtSqlApi(sql sq.SelectBuilder) sq.SelectBuilder

type ApiModel added in v0.3.1

type ApiModel interface {
	Index(ctx context.Context, in *ApiFilter) ([]*SysApi, int64, error)
}

func NewApiModel added in v0.3.1

func NewApiModel(conn sqlx.SqlConn) ApiModel

type DateRange added in v0.3.1

type DateRange struct {
	Start string
	End   string
}

type Keys

type Keys struct {
	Key   string
	Value any
}

type LogModel added in v0.3.1

type LogModel interface {
	LoginLogIndex(ctx context.Context, in *LoginLogFilter) ([]*SysLoginLog, int64, error)
	OperLogIndex(ctx context.Context, in *OperLogFilter) ([]*SysOperLog, int64, error)
}

func NewLogModel added in v0.3.1

func NewLogModel(conn sqlx.SqlConn) LogModel

type LoginLogFilter added in v0.3.1

type LoginLogFilter struct {
	Page          *def.PageInfo
	IpAddr        string
	LoginLocation string
	Data          *DateRange
}

func (*LoginLogFilter) FmtSqlLoginLog added in v0.3.1

func (g *LoginLogFilter) FmtSqlLoginLog(sql sq.SelectBuilder) sq.SelectBuilder
type MenuIndexFilter struct {
	Role    int64
	Name    string
	Path    string
	MenuIds []int64
}
type MenuModel interface {
	Index(ctx context.Context, in *MenuIndexFilter) ([]*SysMenuInfo, error)
	DeleteMenu(ctx context.Context, menuId int64) error
}

func NewMenuModel

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

type OperLogFilter added in v0.3.1

type OperLogFilter struct {
	Page         *def.PageInfo
	OperName     string
	OperUserName string
	BusinessType int64
}

func (*OperLogFilter) FmtSqlOperLog added in v0.3.1

func (g *OperLogFilter) FmtSqlOperLog(sql sq.SelectBuilder) sq.SelectBuilder

type RoleIndexFilter added in v0.3.0

type RoleIndexFilter struct {
	Page   *def.PageInfo
	Name   string
	Status int64
}

type RoleModel

type RoleModel interface {
	Index(in *RoleIndexFilter) ([]*SysRoleInfo, int64, error)
	IndexRoleIDMenuID(RoleId int64) ([]int64, error)
	UpdateRoleIDMenuID(RoleId int64, MenuId []int64) error
	DeleteRole(RoleId int64) error
}

func NewRoleModel

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

type SysApi added in v0.3.1

type SysApi struct {
	Id           int64        `db:"id"`           // 编号
	Route        string       `db:"route"`        // 路由
	Method       int64        `db:"method"`       // 请求方式(1 GET 2 POST 3 HEAD 4 OPTIONS 5 PUT 6 DELETE 7 TRACE 8 CONNECT 9 其它)
	Name         string       `db:"name"`         // 请求名称
	BusinessType int64        `db:"businessType"` // 业务类型(1新增 2修改 3删除 4查询 5其它)
	Group        string       `db:"group"`        // 接口组
	Desc         string       `db:"desc"`         // 备注
	CreatedTime  time.Time    `db:"createdTime"`  // 创建时间
	UpdatedTime  time.Time    `db:"updatedTime"`  // 更新时间
	DeletedTime  sql.NullTime `db:"deletedTime"`
}

type SysApiModel added in v0.3.1

type SysApiModel interface {
	// contains filtered or unexported methods
}

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

func NewSysApiModel added in v0.3.1

func NewSysApiModel(conn sqlx.SqlConn) SysApiModel

NewSysApiModel returns a model for the database table.

type SysLoginLog added in v0.3.1

type SysLoginLog struct {
	Id            int64     `db:"id"`            // 编号
	Uid           int64     `db:"uid"`           // 用户id
	UserName      string    `db:"userName"`      // 登录账号
	IpAddr        string    `db:"ipAddr"`        // 登录IP地址
	LoginLocation string    `db:"loginLocation"` // 登录地点
	Browser       string    `db:"browser"`       // 浏览器类型
	Os            string    `db:"os"`            // 操作系统
	Code          int64     `db:"code"`          // 登录状态(200成功 其它失败)
	Msg           string    `db:"msg"`           // 提示消息
	CreatedTime   time.Time `db:"createdTime"`   // 登录时间
}

type SysLoginLogModel added in v0.3.1

type SysLoginLogModel interface {
	// contains filtered or unexported methods
}

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

func NewSysLoginLogModel added in v0.3.1

func NewSysLoginLogModel(conn sqlx.SqlConn) SysLoginLogModel

NewSysLoginLogModel returns a model for the database table.

type SysMenuInfo added in v0.3.0

type SysMenuInfo struct {
	Id            int64        `db:"id"`            // 编号
	ParentID      int64        `db:"parentID"`      // 父菜单ID,一级菜单为1
	Type          int64        `db:"type"`          // 类型   1:目录   2:菜单   3:按钮
	Order         int64        `db:"order"`         // 左侧table排序序号
	Name          string       `db:"name"`          // 菜单名称
	Path          string       `db:"path"`          // 系统的path
	Component     string       `db:"component"`     // 页面
	Icon          string       `db:"icon"`          // 图标
	Redirect      string       `db:"redirect"`      // 路由重定向
	BackgroundUrl string       `db:"backgroundUrl"` // 后台地址
	HideInMenu    int64        `db:"hideInMenu"`    // 是否隐藏菜单 1-是 2-否
	CreatedTime   time.Time    `db:"createdTime"`   // 创建时间
	UpdatedTime   time.Time    `db:"updatedTime"`   // 更新时间
	DeletedTime   sql.NullTime `db:"deletedTime"`
}

type SysMenuInfoModel added in v0.3.0

type SysMenuInfoModel interface {
	// contains filtered or unexported methods
}

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

func NewSysMenuInfoModel added in v0.3.0

func NewSysMenuInfoModel(conn sqlx.SqlConn) SysMenuInfoModel

NewSysMenuInfoModel returns a model for the database table.

type SysOperLog added in v0.3.1

type SysOperLog struct {
	Id           int64          `db:"id"`           // 编号
	OperUid      int64          `db:"operUid"`      // 用户id
	OperUserName string         `db:"operUserName"` // 操作人员名称
	OperName     string         `db:"operName"`     // 操作名称
	BusinessType int64          `db:"businessType"` // 业务类型(1新增 2修改 3删除 4查询 5其它)
	Uri          string         `db:"uri"`          // 请求地址
	OperIpAddr   string         `db:"operIpAddr"`   // 主机地址
	OperLocation string         `db:"operLocation"` // 操作地点
	Req          sql.NullString `db:"req"`          // 请求参数
	Resp         sql.NullString `db:"resp"`         // 返回参数
	Code         int64          `db:"code"`         // 返回状态(200成功 其它失败)
	Msg          string         `db:"msg"`          // 提示消息
	CreatedTime  time.Time      `db:"createdTime"`  // 操作时间
}

type SysOperLogModel added in v0.3.1

type SysOperLogModel interface {
	// contains filtered or unexported methods
}

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

func NewSysOperLogModel added in v0.3.1

func NewSysOperLogModel(conn sqlx.SqlConn) SysOperLogModel

NewSysOperLogModel returns a model for the database table.

type SysOperationLog added in v0.3.1

type SysOperationLog struct {
	Id           int64          `db:"id"`           // 编号
	OptUid       int64          `db:"optUid"`       // 用户id
	OptUserName  string         `db:"optUserName"`  // 操作人员名称
	OptName      string         `db:"optName"`      // 操作名称
	BusinessType int64          `db:"businessType"` // 业务类型(1新增 2修改 3删除 4查询)
	Uri          string         `db:"uri"`          // 请求地址
	OptIpAddr    string         `db:"optIpAddr"`    // 主机地址
	OptLocation  string         `db:"optLocation"`  // 操作地点
	Req          sql.NullString `db:"req"`          // 请求参数
	Resp         sql.NullString `db:"resp"`         // 返回参数
	Code         int64          `db:"code"`         // 登录状态(200成功 其它失败)
	Msg          string         `db:"msg"`          // 提示消息
	CreatedTime  time.Time      `db:"createdTime"`  // 操作时间
}

type SysOperationLogModel added in v0.3.1

type SysOperationLogModel interface {
	// contains filtered or unexported methods
}

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

func NewSysOperationLogModel added in v0.3.1

func NewSysOperationLogModel(conn sqlx.SqlConn) SysOperationLogModel

NewSysOperationLogModel returns a model for the database table.

type SysRoleInfo added in v0.3.0

type SysRoleInfo struct {
	Id          int64        `db:"id"`          // id编号
	Name        string       `db:"name"`        // 角色名称
	Remark      string       `db:"remark"`      // 备注
	CreatedTime time.Time    `db:"createdTime"` // 创建时间
	UpdatedTime time.Time    `db:"updatedTime"` // 更新时间
	DeletedTime sql.NullTime `db:"deletedTime"`
	Status      int64        `db:"status"` // 状态  1:启用,2:禁用
}

type SysRoleInfoModel added in v0.3.0

type SysRoleInfoModel interface {
	// contains filtered or unexported methods
}

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

func NewSysRoleInfoModel added in v0.3.0

func NewSysRoleInfoModel(conn sqlx.SqlConn) SysRoleInfoModel

NewSysRoleInfoModel returns a model for the database table.

type SysRoleMenu added in v0.3.0

type SysRoleMenu struct {
	Id          int64         `db:"id"`          // id编号
	RoleID      sql.NullInt64 `db:"roleID"`      // 角色ID
	MenuID      sql.NullInt64 `db:"menuID"`      // 菜单ID
	CreatedTime time.Time     `db:"createdTime"` // 创建时间
	UpdatedTime time.Time     `db:"updatedTime"` // 更新时间
	DeletedTime sql.NullTime  `db:"deletedTime"`
}

type SysRoleMenuModel added in v0.3.0

type SysRoleMenuModel interface {
	// contains filtered or unexported methods
}

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

func NewSysRoleMenuModel added in v0.3.0

func NewSysRoleMenuModel(conn sqlx.SqlConn) SysRoleMenuModel

NewSysRoleMenuModel returns a model for the database table.

type SysUserInfo added in v0.3.0

type SysUserInfo struct {
	Uid         int64          `db:"uid"`         // 用户id
	UserName    sql.NullString `db:"userName"`    // 登录用户名
	Password    string         `db:"password"`    // 登录密码
	Email       sql.NullString `db:"email"`       // 邮箱
	Phone       sql.NullString `db:"phone"`       // 手机号
	Wechat      sql.NullString `db:"wechat"`      // 微信union id
	LastIP      string         `db:"lastIP"`      // 最后登录ip
	RegIP       string         `db:"regIP"`       // 注册ip
	NickName    string         `db:"nickName"`    // 用户的昵称
	Sex         int64          `db:"sex"`         // 用户的性别,值为1时是男性,值为2时是女性,其他值为未知
	City        string         `db:"city"`        // 用户所在城市
	Country     string         `db:"country"`     // 用户所在国家
	Province    string         `db:"province"`    // 用户所在省份
	Language    string         `db:"language"`    // 用户的语言,简体中文为zh_CN
	HeadImgUrl  string         `db:"headImgUrl"`  // 用户头像
	Role        int64          `db:"role"`        // 用户角色
	CreatedTime time.Time      `db:"createdTime"` // 创建时间
	UpdatedTime time.Time      `db:"updatedTime"` // 更新时间
	DeletedTime sql.NullTime   `db:"deletedTime"` // 删除时间,默认为空,表示未删除,非空表示已删除
}

type SysUserInfoModel added in v0.3.0

type SysUserInfoModel interface {
	// contains filtered or unexported methods
}

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

func NewSysUserInfoModel added in v0.3.0

func NewSysUserInfoModel(conn sqlx.SqlConn) SysUserInfoModel

NewSysUserInfoModel returns a model for the database table.

type UserIndexFilter added in v0.3.0

type UserIndexFilter struct {
	Page     *def.PageInfo
	UserName string
	Phone    string
	Email    string
}

type UserModel

type UserModel interface {
	Register(ctx context.Context, UserInfoModel SysUserInfoModel, data SysUserInfo, key Keys) error
	Index(in *UserIndexFilter) ([]*SysUserInfo, int64, error)
}

func NewUserModel

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

Jump to

Keyboard shortcuts

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