Documentation
¶
Index ¶
- Constants
- Variables
- type Attachment
- type DeletedAt
- type Menu
- type Model
- func (m *Model) BatchInsert(db *gorm.DB, tableName string, fields []string, data []map[string]interface{})
- func (m *Model) LoadAllWhere(where map[string]map[string]interface{}, model *gorm.DB) *gorm.DB
- func (m *Model) LoadWhereAnd(where map[string]interface{}, model *gorm.DB) *gorm.DB
- func (m *Model) LoadWhereOr(where map[string]interface{}, model *gorm.DB) *gorm.DB
- func (m *Model) ORMModel()
- type Permission
- type Role
- type RoleAssignment
- type User
- type UserAccessToken
- type UserAssignment
- type UserLog
Constants ¶
View Source
const ( PrefixRole = "role::" PrefixPermission = "permission::" )
View Source
const ( MenuStatusOn = iota + 1 MenuStatusOff CacheKeyPrefix = "menu::" MenuCacheKeyAll = CacheKeyPrefix + "all" MenuCacheKeyTree = CacheKeyPrefix + "tree::" )
View Source
const ( EPSGXian1980ThreeDegreeGaussKrugerZone27SRID = 2351 EPSGXian1980ThreeDegreeGaussKrugerZone27SRIDStr = "2351" EPSGXian1980ThreeDegreeGaussKrugerZone27SRIDText = "Xian 1980 / 3-degree Gauss-Kruger zone 27" EPSGCGCS2000ThreeDegreeGaussKrugerZone27SRID = 4515 EPSGCGCS2000ThreeDegreeGaussKrugerZone27SRIDStr = "4515" EPSGCGCS2000ThreeDegreeGaussKrugerZone27SRIDText = "CGCS2000 / 3-degree Gauss-Kruger zone 27" EPSChinaGeodeticCoordinateSystem2000LongLatSRID = 4490 EPSChinaGeodeticCoordinateSystem2000LongLatSRIDStr = "4490" EPSChinaGeodeticCoordinateSystem2000LongLatSRIDText = "China Geodetic Coordinate System 2000" )
View Source
const ( FieldId = "id" FieldCreatedAt = "created_at" FieldUpdatedAt = "created_at" FieldDeletedAt = "deleted_at" )
View Source
const ( PermissionStatusOn = iota + 1 PERMISSION_STATUS_OFF )
View Source
const ( RoleStatusOn = iota + 1 RoleStatusOff )
View Source
const ( UserStatusOn = iota + 1 UserStatusOff UserSexMan = 1 UserSexWoman = 2 UserSexSecret = 3 UserLeaderOn = 1 UserLeaderOff = 2 UserLocalOn = 1 UserLocalOff = 2 )
View Source
const ( UserTypeAdmin = 1 UserTypeClient = 2 UserTypeGuest = 3 UserPlatformAndroid = 1 UserPlatformIos = 2 UserPlatformMiniPro = 3 UserPlatformScreen = 4 UserPlatformGm = 5 )
View Source
const ( UserIdRoot = iota + 1 UserIdAdmin )
Variables ¶
View Source
var ( RoleAssignmentTypes = map[int]string{1: "权限", 2: "菜单"} RoleAssignmentTypePermission = 1 RoleAssignmentTypeMenu = 2 )
View Source
var ( Types = map[int]string{1: "管理员", 2: "用户", 3: "访客"} Statuses = map[int]interface{}{UserStatusOn: "正常", UserStatusOff: "禁止登陆"} Sexes = map[int]string{1: "男", 0: "女"} UserSelectQuery = []string{ "id", "name", "email", "phone", "number", "avatar", "type", "status", "updated_at", "sex", "sort", "remarks", "created_at", "leader", "local", } )
View Source
var ( UserTypes = map[int]string{1: "管理员", 2: "用户", 3: "访客"} UserPlatformMap = map[int]string{ UserPlatformAndroid: "android", UserPlatformIos: "ios", UserPlatformMiniPro: "mini_pro", UserPlatformScreen: "screen", UserPlatformGm: "gm", } )
View Source
var ( UserAssignmentTypes = map[int]string{1: "角色", 2: "权限", 3: "菜单"} UserAssignmentTypeRole = 1 UserAssignmentTypePermission = 2 UserAssignmentTypeMenu = 3 )
View Source
var DefaultMenus = []int64{37, 38}
View Source
var DefaultPermissions = []int64{19, 86, 89, 17, 18, 69, 131, 133, 143, 115, 157}
View Source
var DefaultRoles = []int64{18}
View Source
var ( EPSGMap = map[int]string{ EPSGXian1980ThreeDegreeGaussKrugerZone27SRID: EPSGXian1980ThreeDegreeGaussKrugerZone27SRIDStr, EPSGCGCS2000ThreeDegreeGaussKrugerZone27SRID: EPSGCGCS2000ThreeDegreeGaussKrugerZone27SRIDStr, EPSChinaGeodeticCoordinateSystem2000LongLatSRID: EPSChinaGeodeticCoordinateSystem2000LongLatSRIDStr, } )
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
Model
Key string `gorm:"column:key" db:"key" json:"key" form:"key"` //编号
Url string `gorm:"column:url" db:"url" json:"url" form:"url"` //文件地址
Tag string `gorm:"column:tag" db:"tag" json:"tag" form:"tag"` //文件标签
Name string `gorm:"column:name" db:"name" json:"name" form:"name"` //文件名
}
type Menu ¶
type Menu struct {
Model
Name string `gorm:"name" json:"name,omitempty"`
ParentId int64 `gorm:"parent_id" json:"parent_id,omitempty"`
Url string `gorm:"url" json:"url,omitempty"`
Icon string `gorm:"icon" json:"icon"`
VueComponent string `gorm:"vue_component" json:"vue_component"`
Redirect string `gorm:"redirect" json:"redirect,omitempty"`
Status int `gorm:"status" json:"status"`
Sort int `gorm:"sort" json:"sort"`
Description string `gorm:"description" json:"description"`
}
type Model ¶
type Model struct {
ID int64 `gorm:"primary_key" json:"id" label:"主键ID"`
CreatedAt time.Time `gorm:"column:created_at" json:"created_at" label:"记录添加时间"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at" label:"记录更新时间"`
}
func (*Model) BatchInsert ¶
func (*Model) LoadAllWhere ¶
func (*Model) LoadWhereAnd ¶
func (*Model) LoadWhereOr ¶
type Permission ¶
type Permission struct {
Model
ParentId int64 `gorm:"column:parent_id" json:"parent_id"`
Name string `gorm:"column:name" json:"name"`
Url string `gorm:"column:url" json:"url"`
Method string `gorm:"column:method" json:"method"`
Description string `gorm:"column:description" json:"description"`
Status int `gorm:"column:status" json:"status"`
}
type Role ¶
type Role struct {
Model
Name string `gorm:"column:name" json:"name"`
DisplayName string `gorm:"column:display_name" json:"display_name"`
Description string `gorm:"column:description" json:"description"`
Status int `gorm:"column:status" json:"status"`
Sort int `gorm:"column:sort" json:"sort"`
CardBgUrl string `gorm:"card_bg_url" json:"card_bg_url"`
Port string `gorm:"column:port" json:"port"`
}
type RoleAssignment ¶
type User ¶
type User struct {
Model
Number string `gorm:"column:number" json:"number"` // 编号
Name string `gorm:"column:name" json:"name"` // 用户名
Phone string `gorm:"column:phone" json:"phone"` // 手机号
Email string `gorm:"column:email" json:"email"` // 邮箱
Password string `gorm:"column:password" json:"password"` // 密码
Status int `gorm:"column:status" json:"status"` // 状态: 1/正常;2/注销
Avatar string `gorm:"column:avatar" json:"avatar"` // 头像地址
Type int `gorm:"column:type" json:"type"` // 用户类型: 1/admin; 2/user; 3/访客
Sex int `gorm:"column:sex" json:"sex"` // 性别: 1/男: 2/女: 3/保密
Sort int `gorm:"column:sort" json:"sort"` // 排序
RegisterTime time.Time `gorm:"column:register_time" json:"register_time"` // 注册时间
Remarks string `gorm:"column:remarks" json:"remarks"` // 备注
ExpiredAt *time.Time `gorm:"column:expired_at" json:"expired_at"` // 过期时间
LoginCount int `gorm:"column:login_count" json:"login_count"` // 最大登录次数
Leader int `gorm:"column:leader" json:"leader"` // 是否是领导:1/是;2/否;
Local int `gorm:"column:local" json:"local"` // 是否是领导:1/是;2/否;
}
type UserAccessToken ¶
type UserAccessToken struct {
Model
UserId int64 `gorm:"column:user_id" json:"user_id"`
AccessToken string `gorm:"column:access_token" json:"access_token"`
UserType int `gorm:"column:user_type" json:"user_type"`
Revoked int `gorm:"column:revoked" json:"revoked"`
ExpiredAt time.Time `gorm:"column:expired_at" json:"expired_at"`
Platform int `gorm:"column:platform" json:"platform"` // 平台:1/安卓;2/ios;3/小程序;4/screen;5/gm;
}
type UserAssignment ¶
type UserLog ¶
type UserLog struct {
Model
UserId int64 `gorm:"column:user_id" json:"user_id"`
Ip string `gorm:"column:ip" json:"ip"`
LoginTime *time.Time `gorm:"column:login_time" json:"login_time"`
Longitude float64 `gorm:"column:longitude" json:"longitude" form:"longitude"` //经度
Latitude float64 `gorm:"column:latitude" json:"latitude" form:"latitude"`
Platform int `gorm:"column:platform" json:"platform" form:"platform"`
Version string `gorm:"column:version" json:"version" form:"version"`
}
Click to show internal directories.
Click to hide internal directories.