models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Menu struct {
	database.Model
	ID         string      `gorm:"column:id;size:36;not null;index;" json:"id"`
	Name       string      `gorm:"column:name;not null;index;" json:"name" validate:"required"`
	Sequence   int         `gorm:"column:sequence;not null;index;" json:"sequence" validate:"required"`
	Icon       string      `gorm:"column:icon;" json:"icon" validate:"required"`
	Router     string      `gorm:"column:router;" json:"router"`
	Component  string      `gorm:"column:component;" json:"component"`
	ParentID   string      `gorm:"column:parent_id;size:36;index;" json:"parent_id"`
	ParentPath string      `gorm:"column:parent_path;" json:"parent_path"`
	Hidden     int         `gorm:"column:hidden;not null;" json:"hidden" validate:"required,max=1,min=-1"`
	Status     int         `gorm:"column:status;not null;" json:"status" validate:"required,max=1,min=-1"`
	Remark     string      `gorm:"column:remark;" json:"remark" validate:"required"`
	CreatedBy  string      `gorm:"column:created_by;not null;" json:"created_by"`
	Actions    MenuActions `gorm:"-" json:"actions,omitempty"`
}

ShowStatus - 1: show; -1: hide; Status - 1: Enable -1: Disable

type MenuAction struct {
	database.Model
	ID        string              `gorm:"column:id;size:36;not null;index;" json:"id" yaml:"-"`
	MenuID    string              `gorm:"column:menu_id;size:36;not null;index;" json:"menu_id" yaml:"-"`
	Code      string              `gorm:"column:code;not null;" json:"code" validate:"required" yaml:"code"`
	Name      string              `gorm:"column:name;not null;" json:"name" validate:"required" yaml:"name"`
	Resources MenuActionResources `gorm:"-" json:"resources" yaml:"resources"`
}
type MenuActionQueryParam struct {
	dto.PaginationParam
	dto.OrderParam

	MenuID string
	IDs    []string
}
type MenuActionQueryResult struct {
	List       MenuActions     `json:"list"`
	Pagination *dto.Pagination `json:"pagination"`
}
type MenuActionResource struct {
	database.Model
	ID       string `gorm:"column:id;size:36;index;not null;" json:"-" yaml:"-"`
	ActionID string `gorm:"column:action_id;size:36;index;not null;" json:"-" yaml:"-"`
	Method   string `gorm:"column:method;not null;" json:"method" validate:"required" yaml:"method"`
	Path     string `gorm:"column:path;not null;" json:"path" validate:"required" yaml:"path"`
}
type MenuActionResourceQueryParam struct {
	dto.PaginationParam
	dto.OrderParam

	MenuID  string
	MenuIDs []string
}
type MenuActionResourceQueryResult struct {
	List       MenuActionResources `json:"list"`
	Pagination *dto.Pagination     `json:"pagination"`
}
type MenuActionResources []*MenuActionResource
func (a MenuActionResources) ToActionIDMap() map[string]MenuActionResources
type MenuActions []*MenuAction
func (a MenuActions) FillResources(maResources map[string]MenuActionResources)
func (a MenuActions) ToMap() map[string]*MenuAction
func (a MenuActions) ToMenuIDMap() map[string]MenuActions
type MenuQueryParam struct {
	dto.PaginationParam
	dto.OrderParam

	IDs              []string `query:"ids"`
	Name             string   `query:"name"`
	PrefixParentPath string   `query:"prefix_parent_path"`
	QueryValue       string   `query:"query_value"`
	ParentID         string   `query:"parent_id"`
	Hidden           int      `query:"hidden" validate:"max=1,min=-1"`
	Status           int      `query:"status" validate:"max=1,min=-1"`
	Tree             bool     `query:"tree"`
	IncludeActions   bool     `query:"include_actions"`
}
type MenuQueryResult struct {
	List       Menus           `json:"list"`
	Pagination *dto.Pagination `json:"pagination"`
}
type MenuTree struct {
	ID         string      `yaml:"-" json:"id"`
	Name       string      `yaml:"name" json:"name"`
	Icon       string      `yaml:"icon" json:"icon"`
	Router     string      `yaml:"router,omitempty" json:"router"`
	Component  string      `yaml:"component,omitempty" json:"component"`
	ParentID   string      `yaml:"-" json:"parent_id"`
	ParentPath string      `yaml:"-" json:"parent_path"`
	Sequence   int         `yaml:"sequence" json:"sequence"`
	Hidden     int         `yaml:"-" json:"hidden"`
	Status     int         `yaml:"-" json:"status"`
	Actions    MenuActions `yaml:"actions,omitempty" json:"actions"`
	Children   MenuTrees   `yaml:"children,omitempty" json:"children,omitempty"`
}
type MenuTrees []*MenuTree
func (a MenuTrees) ToTree() MenuTrees
type Menus []*Menu
func (a Menus) FillMenuAction(mActions map[string]MenuActions, mResources map[string]MenuActionResources) Menus
func (a Menus) Len() int
func (a Menus) Less(i, j int) bool
func (a Menus) SplitParentIDs() []string
func (a Menus) Swap(i, j int)
func (a Menus) ToIDs() []string
func (a Menus) ToMap() map[string]*Menu
func (a Menus) ToMenuTrees() MenuTrees

type Role

type Role struct {
	database.Model
	ID        string    `gorm:"column:id;size:36;not null;index;" json:"id"`
	Name      string    `gorm:"column:name;not null;" json:"name" validate:"required"`
	Remark    string    `gorm:"column:remark;not null;" json:"remark" validate:"required"`
	Sequence  int       `gorm:"column:sequence;index;not null;" json:"sequence" validate:"required"`
	Status    int       `gorm:"column:status;default:0;not null;" json:"status" validate:"required,max=1,min=-1"`
	CreatedBy string    `gorm:"column:created_by;not null;" json:"created_by"`
	RoleMenus RoleMenus `gorm:"-" json:"role_menus"`
}

Status - 1: Enable -1: Disable

type RoleMenu

type RoleMenu struct {
	database.Model
	ID       string `gorm:"column:id;size:36;not null;" json:"id"`
	RoleID   string `gorm:"column:role_id;size:36;not null;index;" json:"role_id" validate:"required"`
	MenuID   string `gorm:"column:menu_id;size:36;not null;index;" json:"menu_id" validate:"required"`
	ActionID string `gorm:"column:action_id;size:36;not null;index;" json:"action_id" validate:"required"`
}

type RoleMenuQueryParam

type RoleMenuQueryParam struct {
	dto.PaginationParam
	dto.OrderParam

	RoleID  string
	RoleIDs []string
}

type RoleMenuQueryResult

type RoleMenuQueryResult struct {
	List       RoleMenus       `json:"list"`
	Pagination *dto.Pagination `json:"pagination"`
}

type RoleMenus

type RoleMenus []*RoleMenu

func (RoleMenus) ToActionIDs

func (a RoleMenus) ToActionIDs() []string

func (RoleMenus) ToMap

func (a RoleMenus) ToMap() map[string]*RoleMenu

func (RoleMenus) ToMenuIDs

func (a RoleMenus) ToMenuIDs() []string

func (RoleMenus) ToRoleIDMap

func (a RoleMenus) ToRoleIDMap() map[string]RoleMenus

type RoleQueryParam

type RoleQueryParam struct {
	dto.PaginationParam
	dto.OrderParam

	IDs        []string `query:"ids"`
	Name       string   `query:"name"`
	QueryValue string   `query:"query_value"`
	UserID     string   `query:"user_id"`
	Status     int      `query:"status" validate:"max=1,min=-1"`
}

type RoleQueryResult

type RoleQueryResult struct {
	List       Roles           `json:"list"`
	Pagination *dto.Pagination `json:"pagination"`
}

type Roles

type Roles []*Role

func (Roles) ToMap

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

func (Roles) ToNames

func (a Roles) ToNames() []string

type User

type User struct {
	database.Model
	ID        string    `gorm:"column:id;size:36;index;not null;" json:"id"`
	Username  string    `gorm:"column:username;size:64;not null;index;" json:"username" validate:"required"`
	Realname  string    `gorm:"column:realname;size:64;not null;" json:"realname" validate:"required"`
	Password  string    `gorm:"column:password;not null;" json:"password" json:"phone"`
	Email     string    `gorm:"column:email;default:'';" json:"email"`
	Phone     string    `gorm:"column:phone;default:'';" json:"phone"`
	Status    int       `gorm:"column:status;not null;default:0;" json:"status" validate:"required,max=1,min=-1"`
	CreatedBy string    `gorm:"column:created_by;not null;" json:"created_by"`
	UserRoles UserRoles `gorm:"-" json:"user_roles"`
}

Status - 1: Enable 0: Disable

func (*User) CleanSecure

func (a *User) CleanSecure() *User

type UserInfo

type UserInfo struct {
	ID       string `json:"user_id"`
	Username string `json:"username"`
	Realname string `json:"realname"`
	Roles    Roles  `json:"roles"`
}

type UserQueryParam

type UserQueryParam struct {
	dto.PaginationParam
	dto.OrderParam

	QueryPassword bool
	Username      string   `query:"username"`
	Realname      string   `query:"realname"`
	QueryValue    string   `query:"query_value"`
	Status        int      `query:"status" validate:"max=1,min=-1"`
	RoleIDs       []string `query:"-"`
}

type UserQueryResult

type UserQueryResult struct {
	List       Users           `json:"list"`
	Pagination *dto.Pagination `json:"pagination"`
}

type UserRole

type UserRole struct {
	database.Model
	ID     string `gorm:"column:id;size:36;not null;" json:"id"`
	UserID string `gorm:"column:user_id;size:36;index;not null;" json:"user_id"`
	RoleID string `gorm:"column:role_id;size:36;index;not null;" json:"role_id"`
}

type UserRoleQueryParam

type UserRoleQueryParam struct {
	dto.PaginationParam
	dto.OrderParam

	UserID  string
	UserIDs []string
}

type UserRoleQueryResult

type UserRoleQueryResult struct {
	List       UserRoles       `json:"list"`
	Pagination *dto.Pagination `json:"pagination"`
}

type UserRoles

type UserRoles []*UserRole

func (UserRoles) ToMap

func (a UserRoles) ToMap() map[string]*UserRole

func (UserRoles) ToRoleIDs

func (a UserRoles) ToRoleIDs() []string

func (UserRoles) ToUserIDMap

func (a UserRoles) ToUserIDMap() map[string]UserRoles

type Users

type Users []*User

func (Users) ToIDs

func (a Users) ToIDs() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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