Documentation ¶
Index ¶
- Variables
- func GetAdminNum(filter ...func(*gorm.DB) *gorm.DB) (int64, error)
- func GetGroups() (map[int64]string, error)
- func GetLogNum(filter ...func(*gorm.DB) *gorm.DB) (int64, error)
- func Install(u *Admin, path string) error
- func IsOpen() bool
- func Open(debug bool) (err error)
- type Admin
- type AdminLog
- type Group
- type Menu
- type Node
- type NodeType
Constants ¶
This section is empty.
Variables ¶
View Source
var Config struct { Addr string `default:":8081"` DB struct { Type string `required:"true"` Host string `required:"true"` Port uint64 `yaml:"port,omitempty"` User string `required:"true"` Pass string `yaml:"pass,omitempty"` Name string `yaml:"name,omitempty"` } }
Config 数据库配置项
Functions ¶
func GetAdminNum ¶
GetAdminNum 获取用户数量
Types ¶
type Admin ¶
type Admin struct { ID int64 `gorm:"primary_key;auto_increment"` Email string `gorm:"size:255;unique_index;not null"` Password string `gorm:"size:64;not null" json:"-"` Salt string `gorm:"size:10;not null" json:"-"` GroupID int64 `gorm:"not null"` Headpic string `gorm:"size:255"` LastIP string `gorm:"size:16"` Status bool `gorm:"default:false;not null"` LastLogin *time.Time CreatedAt *time.Time `gorm:"not null"` UpdatedAt *time.Time `json:"-"` DeletedAt *time.Time `json:"-"` Group Group `gorm:"-"` }
Admin 管理员
type AdminLog ¶
type AdminLog struct { ID int64 `gorm:"primary_key;auto_increment" xlsx:"-"` AdminID int64 `gorm:"not null" xlsx:"-"` Admin *Admin `xlsx:"用户"` Path string `gorm:"size:255;not null" xlsx:"路径"` UA string `gorm:"size:255" xlsx:"-"` Commit string `gorm:"type:text" xlsx:"注释"` IP string `gorm:"size:16" xlsx:"IP"` CreatedAt *time.Time `gorm:"type(datetime)" xlsx:"时间"` }
AdminLog 操作日志
type Group ¶
type Group struct { ID int64 `gorm:"primary_key;auto_increment"` Name string `gorm:"size:64;unique;not null"` Nodes []*Node `gorm:"many2many:node_groups;association_autoupdate:false"` }
Group 用户组
type Node ¶
type Node struct { ID int64 `gorm:"primary_key;auto_increment"` Name string `gorm:"size:64;not null"` Parent int64 `gorm:"default:0;not null"` Icon string `gorm:"size:32;default:null"` Remark string `gorm:"type:text"` Path string `gorm:"size:255"` Type NodeType `gorm:"default:0;not null"` Status bool `gorm:"default:false;not null"` Child Menu `gorm:"-"` Groups []*Group `gorm:"many2many:node_groups"` }
Node 节点模型
Click to show internal directories.
Click to hide internal directories.