Documentation
¶
Index ¶
- type LoginCaptcha
- type LoginParam
- type LoginTokenInfo
- type Permission
- type PermissionAction
- type PermissionActions
- type PermissionQueryOptions
- type PermissionQueryParam
- type PermissionQueryResult
- type PermissionResource
- type PermissionResources
- type PermissionTree
- type PermissionTrees
- type Permissions
- type Role
- type RolePermission
- type RolePermissions
- type RoleQueryOptions
- type RoleQueryParam
- type RoleQueryResult
- type Roles
- type UpdatePasswordParam
- type User
- type UserLoginInfo
- type UserQueryOptions
- type UserQueryParam
- type UserQueryResult
- type UserRole
- type UserRoles
- type UserShow
- type UserShowQueryResult
- type UserShows
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoginCaptcha ¶
type LoginCaptcha struct {
CaptchaID string `json:"captcha_id"` // Verification code ID
}
LoginCaptcha - Login verification code
type LoginParam ¶
type LoginParam struct {
UserName string `json:"user_name" binding:"required"` // UserName
Password string `json:"password" binding:"required"` // Password (md5 encryption)
CaptchaID string `json:"captcha_id" binding:"required"` // Verification code ID
CaptchaCode string `json:"captcha_code" binding:"required"` // Verification code
}
LoginParam - Login parameter
type LoginTokenInfo ¶
type LoginTokenInfo struct {
AccessToken string `json:"access_token"` // Access token
TokenType string `json:"token_type"` // Token type
ExpiresAt int64 `json:"expires_at"` // Token expiration timestamp
}
LoginTokenInfo - Login token information
type Permission ¶
type Permission struct {
UUID string `json:"record_id"` // Record ID
Name string `json:"name" binding:"required"` // Permission name
Sequence int `json:"sequence"` // Sort value
Icon string `json:"icon"` // Permission icon
Router string `json:"router"` // Access routing
Hidden int `json:"hidden"` // Hide Permission (0: don't hide 1: hide)
ParentID string `json:"parent_id"` // Parent ID
ParentPath string `json:"parent_path"` // Parent path
Creator string `json:"creator"` // Creator
CreatedAt time.Time `json:"created_at"` // Creation time
Actions PermissionActions `json:"actions"` // Action list
Resources PermissionResources `json:"resources"` // Resource list
}
Permission - Permission object
type PermissionAction ¶
type PermissionAction struct {
Code string `json:"code"` // Action number
Name string `json:"name"` // Action name
}
PermissionAction - Permission action object
type PermissionActions ¶
type PermissionActions []*PermissionAction
PermissionActions - Permission action list
type PermissionQueryOptions ¶
type PermissionQueryOptions struct {
PageParam *schema.PaginationParam // Paging parameter
IncludeActions bool // Contains action list
IncludeResources bool // Include resource list
}
PermissionQueryOptions - Query optional parameter items
type PermissionQueryParam ¶
type PermissionQueryParam struct {
UUIDs []string // Record ID list
LikeName string // Permission name (fuzzy query)
Name string // Permission name
ParentID *string // Parent ID
PrefixParentPath string // Parent path (prefix fuzzy query)
Hidden *int // Hidden Permission
}
PermissionQueryParam - Query conditions
type PermissionQueryResult ¶
type PermissionQueryResult struct {
Data Permissions
PageResult *schema.PaginationResult
}
PermissionQueryResult - Search result
type PermissionResource ¶
type PermissionResource struct {
Code string `json:"code"` // Resource number
Name string `json:"name"` // Resource Name
Method string `json:"method"` // Request method
Path string `json:"path"` // Request path
}
PermissionResource - Permission resource object
type PermissionResources ¶
type PermissionResources []*PermissionResource
PermissionResources - Permission resource list
func (PermissionResources) ForEach ¶
func (a PermissionResources) ForEach(fn func(*PermissionResource, int)) PermissionResources
ForEach - Traversing resource data
func (PermissionResources) ToMap ¶
func (a PermissionResources) ToMap() map[string]*PermissionResource
ToMap - Convert to key-value mapping
type PermissionTree ¶
type PermissionTree struct {
UUID string `json:"record_id"` // Record ID
Name string `json:"name" binding:"required"` // Permission name
Sequence int `json:"sequence"` // Sort value
Icon string `json:"icon"` // Permission icon
Router string `json:"router"` // Access routing
Hidden int `json:"hidden"` // Hide Permission (0: don't hide 1: hide)
ParentID string `json:"parent_id"` // Parent ID
ParentPath string `json:"parent_path"` // Parent path
Resources PermissionResources `json:"resources"` // Resource list
Actions PermissionActions `json:"actions"` // Action list
Children *[]*PermissionTree `json:"children,omitempty"` // Child tree
}
PermissionTree - Permission tree
type PermissionTrees ¶
type PermissionTrees []*PermissionTree
PermissionTrees - Permission tree list
func (PermissionTrees) ForEach ¶
func (a PermissionTrees) ForEach(fn func(*PermissionTree, int)) PermissionTrees
ForEach - Through the data entry
func (PermissionTrees) ToTree ¶
func (a PermissionTrees) ToTree() []*PermissionTree
ToTree - Convert to tree structure
type Permissions ¶
type Permissions []*Permission
Permissions - Permission list
func (Permissions) SplitAndGetAllUUIDs ¶
func (a Permissions) SplitAndGetAllUUIDs() []string
SplitAndGetAllUUIDs - Split parent path and get all record IDs
func (Permissions) ToLeafUUIDs ¶
func (a Permissions) ToLeafUUIDs() []string
ToLeafUUIDs - Convert to leaf node record ID list
func (Permissions) ToMap ¶
func (a Permissions) ToMap() map[string]*Permission
ToMap - Convert to key-value mapping
func (Permissions) ToTrees ¶
func (a Permissions) ToTrees() PermissionTrees
ToTrees - Convert to Permission list
type Role ¶
type Role struct {
UUID string `json:"record_id"` // Record ID
Name string `json:"name" binding:"required"` // Role Name
Sequence int `json:"sequence"` // Sort value
Memo string `json:"memo"` // Remarks
Creator string `json:"creator"` // Creator
CreatedAt time.Time `json:"created_at"` // Creation time
Permissions RolePermissions `json:"permissions" binding:"required,gt=0"` // Permission permission
}
Role - Role object
type RolePermission ¶
type RolePermission struct {
PermissionID string `json:"permission_id"` // Permission ID
Actions []string `json:"actions"` // Action permission list
Resources []string `json:"resources"` // Resource permission list
}
RolePermission - Role permission object
type RolePermissions ¶
type RolePermissions []*RolePermission
RolePermissions - Role permission list
func (RolePermissions) ToPermissionIDs ¶
func (a RolePermissions) ToPermissionIDs() []string
ToPermissionIDs - Convert to permission ID list
type RoleQueryOptions ¶
type RoleQueryOptions struct {
PageParam *schema.PaginationParam // Paging parameter
IncludePermissions bool // Contains permission permissions
}
RoleQueryOptions Query optional parameter items
type RoleQueryParam ¶
type RoleQueryParam struct {
UUIDs []string // Record ID list
Name string // Role Name
LikeName string // Role name (fuzzy query)
UserUUID string // User UUID
}
RoleQueryParam - Query conditions
type RoleQueryResult ¶
type RoleQueryResult struct {
Data Roles
PageResult *schema.PaginationResult
}
RoleQueryResult - Search result
type Roles ¶
type Roles []*Role
Roles - Role object list
func (Roles) ToPermissionIDActionsMap ¶
ToPermissionIDActionsMap - Action permission list mapping converted to permission ID
func (Roles) ToPermissionIDs ¶
ToPermissionIDs - Get all the permission IDs (do not go heavy)
type UpdatePasswordParam ¶
type UpdatePasswordParam struct {
OldPassword string `json:"old_password" binding:"required"` // Old password (md5 encryption)
NewPassword string `json:"new_password" binding:"required"` // Old password (md5 encryption)
}
UpdatePasswordParam - Update password request parameters
type User ¶
type User struct {
UUID string `json:"record_id"` // Record ID
UserName string `json:"user_name" binding:"required"` // UserName
RealName string `json:"real_name" binding:"required"` // RealName
Password string `json:"password"` // Password
Phone string `json:"phone"` // Phone number
Email string `json:"email"` // Email
Status int `json:"status" binding:"required,max=2,min=1"` // User Status (1: Enable 2: Disable)
Creator string `json:"creator"` // Creator
CreatedAt time.Time `json:"created_at"` // Creation time
Roles UserRoles `json:"roles" binding:"required,gt=0"` // Role authorization
}
User - User object
type UserLoginInfo ¶
type UserLoginInfo struct {
UserName string `json:"user_name"` // UserName
RealName string `json:"real_name"` // RealName
RoleNames []string `json:"role_names"` // List of role names
}
UserLoginInfo - User login information
type UserQueryOptions ¶
type UserQueryOptions struct {
PageParam *schema.PaginationParam // Paging parameter
IncludeRoles bool // Include role permissions
}
UserQueryOptions - Query optional parameter items
type UserQueryParam ¶
type UserQueryParam struct {
UserName string // UserName
LikeUserName string // Username (fuzzy query)
LikeRealName string // Real name (fuzzy query)
Status int // User Status (1: Enable 2: Disable)
RoleIDs []string // Role ID list
}
UserQueryParam - Query conditions
type UserQueryResult ¶
type UserQueryResult struct {
Data Users
PageResult *schema.PaginationResult
}
UserQueryResult - User Query result
type UserRole ¶
type UserRole struct {
RoleID string `json:"role_id" swaggo:"true, Role ID"`
}
UserRole - User role
type UserShow ¶
type UserShow struct {
UUID string `json:"record_id"` // Record ID
UserName string `json:"user_name"` // UserName
RealName string `json:"real_name"` // RealName
Phone string `json:"phone"` // Phone
Email string `json:"email"` // Email
Status int `json:"status"` // User Status (1: Enable 2: Disable)
CreatedAt time.Time `json:"created_at"` // Creation time
Roles []*Role `json:"roles"` // Roles List
}
UserShow - User display item
type UserShowQueryResult ¶
type UserShowQueryResult struct {
Data UserShows
PageResult *schema.PaginationResult
}
UserShowQueryResult - User display item query result