Documentation ¶
Index ¶
- type Claims
- type CreateDelete
- type DeletedAt
- func (DeletedAt) DeleteClauses(f *schema.Field) []clause.Interface
- func (t *DeletedAt) MarshalJSON() ([]byte, error)
- func (DeletedAt) QueryClauses(f *schema.Field) []clause.Interface
- func (t *DeletedAt) Scan(v interface{}) error
- func (t *DeletedAt) SetString(str string) *DeletedAt
- func (t *DeletedAt) UnmarshalJSON(data []byte) error
- func (DeletedAt) UpdateClauses(f *schema.Field) []clause.Interface
- func (t DeletedAt) Value() (driver.Value, error)
- type IdParam
- type LocalTime
- type Login
- type Model
- type Page
- type PageInfo
- type SoftDeleteDeleteClause
- type SoftDeleteQueryClause
- type SoftDeleteUpdateClause
- type SysApi
- type SysApiPage
- type SysCasbin
- type SysCasbinPage
- type SysMenu
- type SysMenuPage
- type SysRole
- type SysRoleCasbin
- type SysRolePage
- type SysUser
- type SysUserPage
- type SysUserResponse
- type WhereOrder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateDelete ¶
type DeletedAt ¶
由于gorm提供的DeletedAt没有json tag, 因此自定义为yyyy-MM-dd hh:mm:ss格式
func (*DeletedAt) MarshalJSON ¶
重写time.Time的MarshalJSON方法
func (*DeletedAt) UnmarshalJSON ¶
重写time.Time的UnmarshalJSON方法
type LocalTime ¶
定义为常用的yyyy-MM-dd hh:mm:ss
func (LocalTime) MarshalJSON ¶
重写time.Time的MarshalJSON方法
func (*LocalTime) UnmarshalJSON ¶
重写time.Time的UnmarshalJSON方法
type Model ¶
type Model struct { Id uint64 `gorm:"primaryKey;comment:'自增编号'" json:"id"` CreatedAt LocalTime `gorm:"comment:'创建时间'" json:"createdAt"` UpdatedAt LocalTime `gorm:"comment:'更新时间'" json:"updatedAt"` DeletedAt *DeletedAt `gorm:"index:idx_deleted_at;comment:'删除时间(软删除)'" json:"deletedAt"` }
gorm提供的Model没有json tag,因此进行自定义
type Page ¶
type Page struct { Records interface{} `json:"records"` Total int64 `json:"total"` PageNum int `json:"pageNum"` PageInfo }
分页
func (*Page) SetPageNum ¶
type SoftDeleteDeleteClause ¶
func (SoftDeleteDeleteClause) Build ¶
func (sd SoftDeleteDeleteClause) Build(clause.Builder)
func (SoftDeleteDeleteClause) MergeClause ¶
func (sd SoftDeleteDeleteClause) MergeClause(*clause.Clause)
func (SoftDeleteDeleteClause) ModifyStatement ¶
func (sd SoftDeleteDeleteClause) ModifyStatement(stmt *gorm.Statement)
func (SoftDeleteDeleteClause) Name ¶
func (sd SoftDeleteDeleteClause) Name() string
type SoftDeleteQueryClause ¶
func (SoftDeleteQueryClause) Build ¶
func (sd SoftDeleteQueryClause) Build(clause.Builder)
func (SoftDeleteQueryClause) MergeClause ¶
func (sd SoftDeleteQueryClause) MergeClause(*clause.Clause)
func (SoftDeleteQueryClause) ModifyStatement ¶
func (sd SoftDeleteQueryClause) ModifyStatement(stmt *gorm.Statement)
func (SoftDeleteQueryClause) Name ¶
func (sd SoftDeleteQueryClause) Name() string
type SoftDeleteUpdateClause ¶
func (SoftDeleteUpdateClause) Build ¶
func (sd SoftDeleteUpdateClause) Build(clause.Builder)
func (SoftDeleteUpdateClause) MergeClause ¶
func (sd SoftDeleteUpdateClause) MergeClause(*clause.Clause)
func (SoftDeleteUpdateClause) ModifyStatement ¶
func (sd SoftDeleteUpdateClause) ModifyStatement(stmt *gorm.Statement)
func (SoftDeleteUpdateClause) Name ¶
func (sd SoftDeleteUpdateClause) Name() string
type SysApi ¶
type SysApi struct { Model Method string `gorm:"not null;comment:'请求方式'" json:"method"` Path string `gorm:"not null;comment:'访问路径'" json:"path"` Category string `gorm:"comment:'所属类别'" json:"category"` Desc string `gorm:"comment:'说明'" json:"desc"` Creator string `gorm:"comment:'创建人'" json:"creator"` Roles []uint64 `gorm:"-" json:"roles"` }
type SysApiPage ¶
type SysCasbin ¶
type SysCasbin struct { Id uint64 `gorm:"primaryKey;autoIncrement"` Ptype string `gorm:"colument:ptype;size:100;index:idx_casbin_unique;comment:'策略类型'" json:"type"` V0 string `gorm:"size:100;index:idx_casbin_unique;comment:'角色关键字'" json:"roleKey"` V1 string `gorm:"size:100;index:idx_casbin_unique;comment:'资源名称'" json:"uri"` V2 string `gorm:"size:100;index:idx_casbin_unique;comment:'请求类型'" json:"method"` V3 string `gorm:"size:100;index:idx_casbin_unique;"` V4 string `gorm:"size:100;index:idx_casbin_unique;"` V5 string `gorm:"size:100;index:idx_casbin_unique;"` }
type SysCasbinPage ¶
type SysMenu ¶
type SysMenu struct { Model Name string `gorm:"comment:'菜单英文名称'" json:"name"` Title string `gorm:"comment:'菜单标题(中文名称)'" json:"title"` Icon string `gorm:"comment:'菜单图标'" json:"icon"` Path string `gorm:"comment:'菜单前端访问路径'" json:"path"` Redirect string `gorm:"comment:'重定向路径'" json:"redirect"` Component string `gorm:"comment:'前端组件路径'" json:"component"` Sort *uint `gomr:"type:int unsigned;comment:'菜单顺序(同级比较越小越前)'" json:"sort"` // 定义为指针类型可以避免默认值为0的情况 Status *bool `gorm:"type:tinyint(1);default:1;comment:'菜单状态(0:禁用,1:启动)'" json:"status"` // 定义为指针类型可以避免默认值为false的情况 ParentId uint64 `gorm:"column:parent_id;not null;" json:"parent_id" form:"parentId"` Children []SysMenu `gorm:"-" json:"children"` Roles []SysRole `gorm:"many2many:sys_role_menu_relation;" json:"roles"` // 角色菜单多对多关系表 }
type SysMenuPage ¶
type SysRole ¶
type SysRole struct { Model Name string `gorm:"column:name;size:32;not null;comment:'角色名称'" json:"name" ` NameZh string `gorm:"column:name_zh;size:32;comment:'角色中文名称'" json:"nameZh" ` Sort *uint `gorm:"column:sort;default:1;comment:'角色权限顺序:(顺序越小权限越大)'" json:"sort" ` Status *bool `gorm:"column:status;type:tinyint(1);default:1;comment:'角色状态:(0:禁用,1:启用)'" json:"status" ` Menus []SysMenu `gorm:"many2many:sys_role_menu_relation;" json:"menus"` // 角色菜单多对多关系表 Users []SysUser `gorm:"many2many:sys_user_role_relation;" json:"users"` // 用户角色多对多关系表 }
type SysRoleCasbin ¶
type SysUser ¶
type SysUser struct { Model Username string ` gorm:"column:username;size:32;not null;comment:'用户名'" json:"username" form:"username" ` Password string ` gorm:"column:password;size:64;not null;comment:'密码'" json:"password" form:"password" ` Status *bool `` /* 133-byte string literal not displayed */ Roles []SysRole `gorm:"many2many:sys_user_role_relation;" json:"roles"` }
type SysUserResponse ¶
type SysUserResponse struct { Model Username string `json:"username"` Status *bool `json:"status"` Roles []SysRole `json:"roles"` }
用户信息响应结构体,数据脱敏
type WhereOrder ¶
sql的条件,可以自由再添加or,limit,offset
Click to show internal directories.
Click to hide internal directories.