Documentation ¶
Index ¶
- func PermissionCheck(permissions []Permission, host, path, method string, roles []string) (err error)
- type LoginLog
- type Menu
- type Permission
- type Priority
- type Resource
- type ResourceCategory
- type Role
- type Strings
- type User
- func (u User) MarshalBinary() (data []byte, err error)
- func (u *User) SetPassword(password string)
- func (u *User) Sign(timeout time.Duration) (token, iat, exp string, err error)
- func (u User) TableName() string
- func (u *User) UnmarshalBinary(data []byte) (err error)
- func (u *User) Verification(token string) (err error)
- type Wechat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PermissionCheck ¶
func PermissionCheck(permissions []Permission, host, path, method string, roles []string) (err error)
Types ¶
type LoginLog ¶
type LoginLog struct { Id int64 `gorm:"not null;primaryKey;autoIncrement:false;comment:主键;snowFlake" json:"id"` Version int64 `gorm:"not null;index:fly_login_log_idx_version;comment:版本;version" json:"version"` UserId int64 `gorm:"not null;index:fly_login_log_idx_user_id;comment:用户主键" json:"userId"` Ip sql.NullString `gorm:"type:varchar(50);comment:ip" json:"ip"` Address sql.NullString `gorm:"type:varchar(255);comment:地址" json:"address"` Agent sql.NullString `gorm:"comment:代理" json:"agent"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_login_log_idx_deleted_at;comment:删除时间" json:"deletedAt"` }
登录日志实体
func (LoginLog) MarshalBinary ¶
MarshalBinary 实现BinaryMarshal接口
type Menu ¶
type Menu struct { Show bool `gorm:"not null;comment:显示" json:"show"` Level uint8 `gorm:"not null;comment:级别" json:"level"` Sort uint8 `gorm:"not null;comment:排序" json:"sort"` Id int64 `gorm:"not null;primaryKey;autoIncrement:false;comment:主键;snowFlake" json:"id"` Version int64 `gorm:"not null;index:fly_menu_idx_version;comment:版本;version" json:"version"` Name string `gorm:"type:varchar(50);not null;uniqueIndex:fly_menu_uqe_idx_name;comment:名称" json:"name"` ParentId sql.NullInt64 `gorm:"index:fly_menu_idx_parent_id;comment:父级主键" json:"parentId"` Icon sql.NullString `gorm:"type:varchar(255);comment:图标" json:"icon"` Remarks sql.NullString `gorm:"type:varchar(255);comment:备注" json:"remarks"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_menu_idx_deleted_at;comment:删除时间" json:"deletedAt"` }
Menu 菜单实体
func (Menu) MarshalBinary ¶
MarshalBinary 实现BinaryMarshal接口
type Permission ¶
type Permission struct { Status bool `gorm:"not null;comment:启用状态" json:"status"` IsSystem bool `gorm:"not null;comment:系统标识" json:"isSystem"` AllowAnyone bool `gorm:"not null;comment:是否允许匿名访问" json:"allowAnyone"` Id int64 `gorm:"not null;primaryKey;autoIncrement:false;comment:主键;snowFlake" json:"id"` Version int64 `gorm:"not null;index:fly_permission_idx_version;comment:版本;version" json:"version"` Group string `gorm:"type:varchar(50);not null;comment:分组" json:"group"` Host string `gorm:"type:varchar(255);not null;comment:主机" json:"host"` Path string `gorm:"type:varchar(255);not null;comment:路径" json:"path"` Method string `gorm:"type:varchar(7);not null;comment:方法" json:"method"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_permission_idx_deleted_at;comment:删除时间" json:"deletedAt"` Priority Priority `gorm:"not null;comment:优先级" json:"priority"` AuthorizedRoles *Strings `gorm:"type:text;comment:允许角色" json:"authorizedRoles"` ForbiddenRoles *Strings `gorm:"type:text;comment:禁止角色" json:"forbiddenRoles"` }
Permission 权限实体
func (Permission) MarshalBinary ¶
func (p Permission) MarshalBinary() (data []byte, err error)
MarshalBinary 实现BinaryMarshal接口
func (*Permission) UnmarshalBinary ¶
func (p *Permission) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary 实现BinaryUnmarshal接口
type Resource ¶
type Resource struct { Id int64 `gorm:"not null;primaryKey;autoIncrement:false;comment:主键;snowFlake" json:"id"` Version int64 `gorm:"not null;index:fly_resource_idx_version;comment:版本;version" json:"version"` ResourceCategoryId int64 `gorm:"not null;index:fly_resource_idx_resource_category_id;comment:资源分类主键" json:"resourceCategoryId"` Name string `gorm:"type:varchar(50);not null;uniqueIndex:fly_resource_uqe_idx_name;comment:名称" json:"name"` Path string `gorm:"type:varchar(255);not null;comment:路径" json:"path"` Remarks sql.NullString `gorm:"type:varchar(255);comment:备注" json:"remarks"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_resource_idx_deleted_at;comment:删除时间" json:"deletedAt"` }
Resource 资源实体
func (Resource) MarshalBinary ¶
MarshalBinary 实现BinaryMarshal接口
type ResourceCategory ¶
type ResourceCategory struct { Id int64 `gorm:"not null;primaryKey;autoIncrement:false;comment:主键;snowFlake" json:"id"` Version int64 `gorm:"not null;index:fly_resource_category_idx_version;comment:版本;version" json:"version"` Name string `gorm:"type:varchar(50);not null;uniqueIndex:fly_resource_category_uqe_idx_name;comment:名称" json:"name"` Remarks sql.NullString `gorm:"type:varchar(255);comment:备注" json:"remarks"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_resource_category_idx_deleted_at;comment:删除时间" json:"deletedAt"` }
ResourceCategory 资源分类实体
func (ResourceCategory) MarshalBinary ¶
func (rc ResourceCategory) MarshalBinary() (data []byte, err error)
MarshalBinary 实现BinaryMarshal接口
func (*ResourceCategory) UnmarshalBinary ¶
func (rc *ResourceCategory) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary 实现BinaryUnmarshal接口
type Role ¶
type Role struct { Status bool `gorm:"comment:启用状态" json:"status"` Id int64 `gorm:"not null;primaryKey;autoIncrement:false;comment:主键;snowFlake" json:"id"` Version int64 `gorm:"not null;index:fly_role_idx_version;comment:版本;version" json:"version"` Name string `gorm:"type:varchar(50);not null;uniqueIndex:fly_role_uqe_idx_name;comment:名称" json:"name"` Remarks sql.NullString `gorm:"type:varchar(255);comment:备注" json:"remarks"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_role_idx_deleted_at;comment:删除时间" json:"deletedAt"` }
Role 角色实体
func (Role) MarshalBinary ¶
MarshalBinary 实现BinaryMarshal接口
type User ¶
type User struct { Id int64 `gorm:"not null;primaryKey;autoIncrement:false;comment:主键;snowFlake" json:"id"` Version int64 `gorm:"not null;index:fly_user_idx_version;comment:版本;version" json:"version"` Phone string `gorm:"type:varchar(20);not null;uniqueIndex:fly_user_uqe_idx_phone;comment:手机号码" json:"phone"` Password string `gorm:"type:varchar(32);not null;comment:密码" json:"password"` Salt string `gorm:"type:varchar(32);not null;comment:盐值" json:"salt"` Avatar sql.NullString `gorm:"type:varchar(255);comment:头像" json:"avatar"` Nickname sql.NullString `gorm:"type:varchar(50);comment:昵称" json:"nickname"` Gender sql.NullString `gorm:"type:varchar(7);comment:性别 unknown、male、female" json:"gender"` Address sql.NullString `gorm:"type:varchar(255);comment:地址" json:"address"` Remarks sql.NullString `gorm:"type:varchar(255);comment:备注" json:"remarks"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_user_idx_deleted_at;comment:删除时间" json:"deletedAt"` }
User 用户实体
func (User) MarshalBinary ¶
MarshalBinary 实现BinaryMarshal接口
func (*User) Sign ¶
Sign 用户签名
func (*User) UnmarshalBinary ¶
UnmarshalBinary 实现BinaryUnmarshal接口
type Wechat ¶
type Wechat struct { OpenId string `gorm:"type:varchar(128);not null;primaryKey;autoIncrement:false;comment:微信openId" json:"openId"` UserId int64 `gorm:"index:fly_wechat_idx_user_id;comment:用户主键" json:"userId"` UnionId sql.NullString `gorm:"type:varchar(128);comment:微信unionId" json:"unionId"` CreatedAt time.Time `gorm:"not null;autoCreateTime;comment:创建时间" json:"createdAt"` UpdatedAt time.Time `gorm:"not null;autoCreateTime;autoUpdateTime;comment:更新时间" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index:fly_wechat_idx_deleted_at;comment:删除时间" json:"deletedAt"` }
Wechat 微信实体
func (Wechat) MarshalBinary ¶
MarshalBinary 实现BinaryMarshal接口
Source Files ¶
Click to show internal directories.
Click to hide internal directories.