import "github.com/GoAdminGroup/go-admin/plugins/admin/models"
base.go menu.go operation_log.go permission.go role.go site.go user.go
const ( SiteItemOpenState = 1 SiteItemOffState = 0 )
Base is base model structure.
func (b Base) SetConn(con db.Connection) Base
type MenuModel struct { Base Id int64 Title string ParentId int64 Icon string Uri string Header string CreatedAt string UpdatedAt string }
MenuModel is menu model structure.
Menu return a default menu model.
MenuWithId return a default menu model of given id.
AddRole add a role to the menu.
CheckRole check the role if has permission to get the menu.
Delete delete the menu model.
DeleteRoles delete roles with menu.
Find return a default menu model of given id.
MapToModel get the menu model from given map.
func (t MenuModel) New(title, icon, uri, header, pluginName string, parentId, order int64) (MenuModel, error)
New create a new menu model.
ResetOrder update the order of menu models.
func (t MenuModel) SetConn(con db.Connection) MenuModel
func (t MenuModel) Update(title, icon, uri, header, pluginName string, parentId int64) (int64, error)
Update update the menu model.
type OperationLogModel struct { Base Id int64 UserId int64 Path string Method string Ip string Input string CreatedAt string UpdatedAt string }
OperationLogModel is operation log model structure.
func OperationLog() OperationLogModel
OperationLog return a default operation log model.
func (t OperationLogModel) Find(id interface{}) OperationLogModel
Find return a default operation log model of given id.
func (t OperationLogModel) MapToModel(m map[string]interface{}) OperationLogModel
MapToModel get the operation log model from given map.
func (t OperationLogModel) New(userId int64, path, method, ip, input string) OperationLogModel
New create a new operation log model.
func (t OperationLogModel) SetConn(con db.Connection) OperationLogModel
type OrderItem struct { ID uint `json:"id"` Children OrderItems `json:"children"` }
type PermissionModel struct { Base Id int64 Name string Slug string HttpMethod []string HttpPath []string CreatedAt string UpdatedAt string }
PermissionModel is permission model structure.
func Permission() PermissionModel
Permission return a default permission model.
func PermissionWithId(id string) PermissionModel
PermissionWithId return a default permission model of given id.
func (t PermissionModel) Find(id interface{}) PermissionModel
Find return the permission model of given id.
func (t PermissionModel) FindByName(name string) PermissionModel
FindBySlug return the permission model of given slug.
func (t PermissionModel) FindBySlug(slug string) PermissionModel
FindBySlug return the permission model of given slug.
func (t PermissionModel) IsEmpty() bool
IsEmpty check the user model is empty or not.
func (t PermissionModel) IsSlugExist(slug string, id string) bool
IsSlugExist check the row exist with given slug and id.
func (t PermissionModel) MapToModel(m map[string]interface{}) PermissionModel
MapToModel get the permission model from given map.
func (t PermissionModel) SetConn(con db.Connection) PermissionModel
RoleModel is role model structure.
Role return a default role model.
RoleWithId return a default role model of given id.
AddPermission add the permissions to the role.
CheckPermission check the permission of role.
DeletePermissions delete all the permissions of role.
Find return a default role model of given id.
IsSlugExist check the row exist with given slug and id.
MapToModel get the role model from given map.
New create a role model.
func (t RoleModel) SetConn(con db.Connection) RoleModel
Update update the role model.
type SiteModel struct { Base Id int64 Key string Value string Desc string State int64 CreatedAt string UpdatedAt string }
SiteModel is role model structure.
Site return a default role model.
func (t SiteModel) SetConn(con db.Connection) SiteModel
type UserModel struct { Base `json:"-"` Id int64 `json:"id"` Name string `json:"name"` UserName string `json:"user_name"` Password string `json:"password"` Avatar string `json:"avatar"` RememberToken string `json:"remember_token"` Permissions []PermissionModel `json:"permissions"` MenuIds []int64 `json:"menu_ids"` Roles []RoleModel `json:"role"` Level string `json:"level"` LevelName string `json:"level_name"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` // contains filtered or unexported fields }
UserModel is user model structure.
User return a default user model.
UserWithId return a default user model of given id.
AddPermission add a permission of the user model.
AddRole add a role of the user model.
CheckPermission check the permission of the user.
CheckPermission check the permission of the user.
CheckRole check the role of the user.
CheckRole check the role of the user model.
DeletePermissions delete all the permissions of the user model.
DeleteRoles delete all the roles of the user model.
Find return a default user model of given id.
FindByUserName return a default user model of given name.
HasMenu check the user has visitable menu or not.
IsEmpty check the user model is empty or not.
IsSuperAdmin check the user model is super admin or not.
MapToModel get the user model from given map.
New create a user model.
UpdateAvatar update the avatar of user.
func (t UserModel) SetConn(con db.Connection) UserModel
Update update the user model.
UpdateAvatar update the avatar of user.
UpdatePwd update the password of the user model.
WithMenus query the menu info of the user.
WithPermissions query the permission info of the user.
WithRoles query the role info of the user.
Package models imports 15 packages (graph) and is imported by 27 packages. Updated 2020-11-07. Refresh now. Tools for package owners.