entity

package
v0.0.0-...-7695f31 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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

func (ll LoginLog) MarshalBinary() (data []byte, err error)

MarshalBinary 实现BinaryMarshal接口

func (LoginLog) TableName

func (ll LoginLog) TableName() string

TableName 表名

func (*LoginLog) UnmarshalBinary

func (ll *LoginLog) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary 实现BinaryUnmarshal接口

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 (m Menu) MarshalBinary() (data []byte, err error)

MarshalBinary 实现BinaryMarshal接口

func (m Menu) TableName() string

TableName 表名

func (m *Menu) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary 实现BinaryUnmarshal接口

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) TableName

func (p Permission) TableName() string

TableName 表名

func (*Permission) UnmarshalBinary

func (p *Permission) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary 实现BinaryUnmarshal接口

type Priority

type Priority int
const (
	DefaultPriority Priority = iota
	SystemPriority
	CustomPriority
)

func (*Priority) Scan

func (p *Priority) Scan(value interface{}) (err error)

func (Priority) Value

func (p Priority) Value() (value driver.Value, err error)

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

func (r Resource) MarshalBinary() (data []byte, err error)

MarshalBinary 实现BinaryMarshal接口

func (*Resource) TableName

func (r *Resource) TableName() string

TableName 表名

func (*Resource) UnmarshalBinary

func (r *Resource) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary 实现BinaryUnmarshal接口

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) TableName

func (rc *ResourceCategory) TableName() string

TableName 表名

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

func (r Role) MarshalBinary() (data []byte, err error)

MarshalBinary 实现BinaryMarshal接口

func (Role) TableName

func (r Role) TableName() string

TableName 表名

func (*Role) UnmarshalBinary

func (r *Role) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary 实现BinaryUnmarshal接口

type Strings

type Strings struct {
	Val []string
}

func (*Strings) Scan

func (s *Strings) Scan(value interface{}) (err error)

func (Strings) Value

func (s Strings) Value() (value driver.Value, err error)

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

func (u User) MarshalBinary() (data []byte, err error)

MarshalBinary 实现BinaryMarshal接口

func (*User) SetPassword

func (u *User) SetPassword(password string)

SetPassword 设置密码

func (*User) Sign

func (u *User) Sign(timeout time.Duration) (token, iat, exp string, err error)

Sign 用户签名

func (User) TableName

func (u User) TableName() string

TableName 表名

func (*User) UnmarshalBinary

func (u *User) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary 实现BinaryUnmarshal接口

func (*User) Verification

func (u *User) Verification(token string) (err error)

Verification 用户验证

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

func (w Wechat) MarshalBinary() (data []byte, err error)

MarshalBinary 实现BinaryMarshal接口

func (Wechat) TableName

func (w Wechat) TableName() string

TableName 表名

func (*Wechat) UnmarshalBinary

func (w *Wechat) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary 实现BinaryUnmarshal接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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