schema

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Demo

type Demo struct {
	RecordID  string    `json:"record_id"`                             // 记录ID
	Code      string    `json:"code" binding:"required"`               // 编号
	Name      string    `json:"name" binding:"required"`               // 名称
	Memo      string    `json:"memo"`                                  // 备注
	Status    int       `json:"status" binding:"required,max=2,min=1"` // 状态(1:启用 2:停用)
	Creator   string    `json:"creator"`                               // 创建者
	CreatedAt time.Time `json:"created_at"`                            // 创建时间
}

Demo demo对象

type DemoQueryOptions

type DemoQueryOptions struct {
	PageParam *PaginationParam // 分页参数
}

DemoQueryOptions demo对象查询可选参数项

type DemoQueryParam

type DemoQueryParam struct {
	Code     string // 编号
	Status   int    // 状态(1:启用 2:停用)
	LikeCode string // 编号(模糊查询)
	LikeName string // 名称(模糊查询)
}

DemoQueryParam 查询条件

type DemoQueryResult

type DemoQueryResult struct {
	Data       []*Demo
	PageResult *PaginationResult
}

DemoQueryResult demo对象查询结果

type HTTPError

type HTTPError struct {
	Error HTTPErrorItem `json:"error"` // 错误项
}

HTTPError HTTP响应错误

type HTTPErrorItem

type HTTPErrorItem struct {
	Code    int    `json:"code"`    // 错误码
	Message string `json:"message"` // 错误信息
}

HTTPErrorItem HTTP响应错误项

type HTTPList

type HTTPList struct {
	List       interface{}     `json:"list"`
	Pagination *HTTPPagination `json:"pagination,omitempty"`
}

HTTPList HTTP响应列表数据

type HTTPPagination

type HTTPPagination struct {
	Total    int `json:"total"`
	Current  int `json:"current"`
	PageSize int `json:"pageSize"`
}

HTTPPagination HTTP分页数据

type HTTPStatus

type HTTPStatus struct {
	Status string `json:"status"` // 状态(OK)
}

HTTPStatus HTTP响应状态

type HTTPStatusText

type HTTPStatusText string

HTTPStatusText 定义HTTP状态文本

const (
	OKStatusText HTTPStatusText = "OK"
)

定义HTTP状态文本常量

func (HTTPStatusText) String

func (t HTTPStatusText) String() string

type LoginCaptcha

type LoginCaptcha struct {
	CaptchaID string `json:"captcha_id"` // 验证码ID
}

LoginCaptcha 登录验证码

type LoginParam

type LoginParam struct {
	UserName    string `json:"user_name" binding:"required"`    // 用户名
	Password    string `json:"password" binding:"required"`     // 密码(md5加密)
	CaptchaID   string `json:"captcha_id" binding:"required"`   // 验证码ID
	CaptchaCode string `json:"captcha_code" binding:"required"` // 验证码
}

LoginParam 登录参数

type LoginTokenInfo

type LoginTokenInfo struct {
	AccessToken string `json:"access_token"` // 访问令牌
	TokenType   string `json:"token_type"`   // 令牌类型
	ExpiresAt   int64  `json:"expires_at"`   // 令牌到期时间戳
}

LoginTokenInfo 登录令牌信息

type Menu struct {
	RecordID   string        `json:"record_id"`               // 记录ID
	Name       string        `json:"name" binding:"required"` // 菜单名称
	Sequence   int           `json:"sequence"`                // 排序值
	Icon       string        `json:"icon"`                    // 菜单图标
	Router     string        `json:"router"`                  // 访问路由
	Hidden     int           `json:"hidden"`                  // 隐藏菜单(0:不隐藏 1:隐藏)
	ParentID   string        `json:"parent_id"`               // 父级ID
	ParentPath string        `json:"parent_path"`             // 父级路径
	Creator    string        `json:"creator"`                 // 创建者
	CreatedAt  time.Time     `json:"created_at"`              // 创建时间
	Actions    MenuActions   `json:"actions"`                 // 动作列表
	Resources  MenuResources `json:"resources"`               // 资源列表
}

Menu 菜单对象

type MenuAction struct {
	Code string `json:"code"` // 动作编号
	Name string `json:"name"` // 动作名称
}

MenuAction 菜单动作对象

type MenuActions []*MenuAction

MenuActions 菜单动作列表

type MenuQueryOptions struct {
	PageParam        *PaginationParam // 分页参数
	IncludeActions   bool             // 包含动作列表
	IncludeResources bool             // 包含资源列表
}

MenuQueryOptions 查询可选参数项

type MenuQueryParam struct {
	RecordIDs        []string // 记录ID列表
	LikeName         string   // 菜单名称(模糊查询)
	Name             string   // 菜单名称
	ParentID         *string  // 父级内码
	PrefixParentPath string   // 父级路径(前缀模糊查询)
	Hidden           *int     // 隐藏菜单
}

MenuQueryParam 查询条件

type MenuQueryResult struct {
	Data       Menus
	PageResult *PaginationResult
}

MenuQueryResult 查询结果

type MenuResource struct {
	Code   string `json:"code"`   // 资源编号
	Name   string `json:"name"`   // 资源名称
	Method string `json:"method"` // 请求方式
	Path   string `json:"path"`   // 请求路径
}

MenuResource 菜单资源对象

type MenuResources []*MenuResource

MenuResources 菜单资源列表

func (a MenuResources) ForEach(fn func(*MenuResource, int)) MenuResources

ForEach 遍历资源数据

func (a MenuResources) ToMap() map[string]*MenuResource

ToMap 转换为键值映射

type MenuTree struct {
	RecordID   string        `json:"record_id"`               // 记录ID
	Name       string        `json:"name" binding:"required"` // 菜单名称
	Sequence   int           `json:"sequence"`                // 排序值
	Icon       string        `json:"icon"`                    // 菜单图标
	Router     string        `json:"router"`                  // 访问路由
	Hidden     int           `json:"hidden"`                  // 隐藏菜单(0:不隐藏 1:隐藏)
	ParentID   string        `json:"parent_id"`               // 父级ID
	ParentPath string        `json:"parent_path"`             // 父级路径
	Resources  MenuResources `json:"resources"`               // 资源列表
	Actions    MenuActions   `json:"actions"`                 // 动作列表
	Children   *[]*MenuTree  `json:"children,omitempty"`      // 子级树
}

MenuTree 菜单树

type MenuTrees []*MenuTree

MenuTrees 菜单树列表

func (a MenuTrees) ForEach(fn func(*MenuTree, int)) MenuTrees

ForEach 遍历数据项

func (a MenuTrees) ToTree() []*MenuTree

ToTree 转换为树形结构

type Menus []*Menu

Menus 菜单列表

func (a Menus) SplitAndGetAllRecordIDs() []string

SplitAndGetAllRecordIDs 拆分父级路径并获取所有记录ID

func (a Menus) ToLeafRecordIDs() []string

ToLeafRecordIDs 转换为叶子节点记录ID列表

func (a Menus) ToMap() map[string]*Menu

ToMap 转换为键值映射

func (a Menus) ToTrees() MenuTrees

ToTrees 转换为菜单列表

type PaginationParam

type PaginationParam struct {
	PageIndex int // 页索引
	PageSize  int // 页大小
}

PaginationParam 分页查询条件

type PaginationResult

type PaginationResult struct {
	Total int // 总数据条数
}

PaginationResult 分页查询结果

type Role

type Role struct {
	RecordID  string    `json:"record_id"`                     // 记录ID
	Name      string    `json:"name" binding:"required"`       // 角色名称
	Sequence  int       `json:"sequence"`                      // 排序值
	Memo      string    `json:"memo"`                          // 备注
	Creator   string    `json:"creator"`                       // 创建者
	CreatedAt time.Time `json:"created_at"`                    // 创建时间
	Menus     RoleMenus `json:"menus" binding:"required,gt=0"` // 菜单权限
}

Role 角色对象

type RoleMenu

type RoleMenu struct {
	MenuID    string   `json:"menu_id"`   // 菜单ID
	Actions   []string `json:"actions"`   // 动作权限列表
	Resources []string `json:"resources"` // 资源权限列表
}

RoleMenu 角色菜单对象

type RoleMenus

type RoleMenus []*RoleMenu

RoleMenus 角色菜单列表

func (RoleMenus) ToMenuIDs

func (a RoleMenus) ToMenuIDs() []string

ToMenuIDs 转换为菜单ID列表

type RoleQueryOptions

type RoleQueryOptions struct {
	PageParam    *PaginationParam // 分页参数
	IncludeMenus bool             // 包含菜单权限
}

RoleQueryOptions 查询可选参数项

type RoleQueryParam

type RoleQueryParam struct {
	RecordIDs []string // 记录ID列表
	Name      string   // 角色名称
	LikeName  string   // 角色名称(模糊查询)
	UserID    string   // 用户ID
}

RoleQueryParam 查询条件

type RoleQueryResult

type RoleQueryResult struct {
	Data       Roles
	PageResult *PaginationResult
}

RoleQueryResult 查询结果

type Roles

type Roles []*Role

Roles 角色对象列表

func (Roles) ToMap

func (a Roles) ToMap() map[string]*Role

ToMap 转换为键值存储

func (Roles) ToMenuIDActionsMap

func (a Roles) ToMenuIDActionsMap() map[string][]string

ToMenuIDActionsMap 转换为菜单ID的动作权限列表映射

func (Roles) ToMenuIDs

func (a Roles) ToMenuIDs() []string

ToMenuIDs 获取所有的菜单ID(不去重)

func (Roles) ToNames

func (a Roles) ToNames() []string

ToNames 获取角色名称列表

type UpdatePasswordParam

type UpdatePasswordParam struct {
	OldPassword string `json:"old_password" binding:"required"` // 旧密码(md5加密)
	NewPassword string `json:"new_password" binding:"required"` // 新密码(md5加密)
}

UpdatePasswordParam 更新密码请求参数

type User

type User struct {
	RecordID  string    `json:"record_id"`                             // 记录ID
	UserName  string    `json:"user_name" binding:"required"`          // 用户名
	RealName  string    `json:"real_name" binding:"required"`          // 真实姓名
	Password  string    `json:"password"`                              // 密码
	Phone     string    `json:"phone"`                                 // 手机号
	Email     string    `json:"email"`                                 // 邮箱
	Status    int       `json:"status" binding:"required,max=2,min=1"` // 用户状态(1:启用 2:停用)
	Creator   string    `json:"creator"`                               // 创建者
	CreatedAt time.Time `json:"created_at"`                            // 创建时间
	Roles     UserRoles `json:"roles" binding:"required,gt=0"`         // 角色授权
}

User 用户对象

func (*User) CleanSecure

func (a *User) CleanSecure() *User

CleanSecure 清理安全数据

type UserLoginInfo

type UserLoginInfo struct {
	UserName  string   `json:"user_name"`  // 用户名
	RealName  string   `json:"real_name"`  // 真实姓名
	RoleNames []string `json:"role_names"` // 角色名列表
}

UserLoginInfo 用户登录信息

type UserQueryOptions

type UserQueryOptions struct {
	PageParam    *PaginationParam // 分页参数
	IncludeRoles bool             // 包含角色权限
}

UserQueryOptions 查询可选参数项

type UserQueryParam

type UserQueryParam struct {
	UserName     string   // 用户名
	LikeUserName string   // 用户名(模糊查询)
	LikeRealName string   // 真实姓名(模糊查询)
	Status       int      // 用户状态(1:启用 2:停用)
	RoleIDs      []string // 角色ID列表
}

UserQueryParam 查询条件

type UserQueryResult

type UserQueryResult struct {
	Data       Users
	PageResult *PaginationResult
}

UserQueryResult 查询结果

type UserRole

type UserRole struct {
	RoleID string `json:"role_id" swaggo:"true,角色ID"`
}

UserRole 用户角色

type UserRoles

type UserRoles []*UserRole

UserRoles 用户角色列表

func (UserRoles) ToRoleIDs

func (a UserRoles) ToRoleIDs() []string

ToRoleIDs 转换为角色ID列表

type UserShow

type UserShow struct {
	RecordID  string    `json:"record_id"`  // 记录ID
	UserName  string    `json:"user_name"`  // 用户名
	RealName  string    `json:"real_name"`  // 真实姓名
	Phone     string    `json:"phone"`      // 手机号
	Email     string    `json:"email"`      // 邮箱
	Status    int       `json:"status"`     // 用户状态(1:启用 2:停用)
	CreatedAt time.Time `json:"created_at"` // 创建时间
	Roles     []*Role   `json:"roles"`      // 授权角色列表
}

UserShow 用户显示项

type UserShowQueryResult

type UserShowQueryResult struct {
	Data       UserShows
	PageResult *PaginationResult
}

UserShowQueryResult 用户显示项查询结果

type UserShows

type UserShows []*UserShow

UserShows 用户显示项列表

type Users

type Users []*User

Users 用户对象列表

func (Users) ToRoleIDs

func (a Users) ToRoleIDs() []string

ToRoleIDs 获取角色ID列表

func (Users) ToUserShows

func (a Users) ToUserShows(mroles map[string]*Role) UserShows

ToUserShows 转换为用户显示列表

Jump to

Keyboard shortcuts

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