model

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	gorm.Model
	Path        string `json:"path" gorm:"comment:api path"`                    // api path
	Description string `json:"description" gorm:"comment:api description"`      // api description
	ApiGroup    string `json:"apiGroup" gorm:"comment:api group"`               // api group
	Method      string `json:"method" gorm:"default:POST;comment: http method"` // http method
}
type Menu struct {
	gorm.Model
	MenuLevel uint32      `json:"level" gorm:"comment:menu level"`
	MenuType  uint32      `json:"type" gorm:"comment:menu type: 0. group 1. menu"`
	ParentId  uint        `json:"parentId" gorm:"comment:parent menu id"`                  // parent menu id
	Path      string      `json:"path" gorm:"comment:index path"`                          // index path
	Name      string      `json:"name" gorm:"comment:index name"`                          // index name
	Redirect  string      `json:"redirect" gorm:"comment: redirect path"`                  // redirect path
	Component string      `json:"component" gorm:"comment:the path of vue file"`           // the path of vue file
	OrderNo   uint32      `json:"orderNo" gorm:"default:0;comment:numbers for sorting"`    // sorting numbers
	Disabled  bool        `json:"disabled" gorm:"default:false;comment:if true, disable;"` //disable status
	Meta      Meta        `json:"meta" gorm:"embedded;comment:extra parameters"`           // extra parameters
	Roles     []Role      `json:"roles" gorm:"many2many:role_menus;"`
	Children  []Menu      `json:"children" gorm:"foreignKey:ParentId;references:id"`
	Param     []MenuParam `json:"parameters"`
}
type MenuParam struct {
	gorm.Model
	MenuId uint
	Type   string `json:"type" gorm:"comment:pass parameters via params or query "` // pass parameters via params or query
	Key    string `json:"key" gorm:"comment:the key of parameters"`                 // the key of parameters
	Value  string `json:"value" gorm:"comment:the value of parameters"`             // the value of parameters
}

type Meta

type Meta struct {
	Title              string `json:"title" gorm:"comment:menu name"`                                          // menu name
	Icon               string `json:"icon" gorm:"comment:menu icon"`                                           // menu icon
	HideMenu           bool   `json:"hideMenu" gorm:"default:false;comment:hide the menu"`                     // hide menu
	HideBreadcrumb     bool   `json:"hideBreadcrumb" gorm:"default:true;comment: hide the breadcrumb"`         // hide the breadcrumb
	CurrentActiveMenu  string `json:"currentActiveMenu" gorm:"comment:set the active menu"`                    // set the active menu
	IgnoreKeepAlive    bool   `json:"ignoreKeepAlive" gorm:"comment: do not keep alive the tab"`               // do not keep alive the tab
	HideTab            bool   `json:"hideTab" gorm:"comment: hide the tab header"`                             // hide the tab header
	FrameSrc           string `json:"frameSrc" gorm:"comment:iframe path"`                                     // show iframe
	CarryParam         bool   `json:"carryParam" gorm:"comment:the route carries parameters or not"`           // the route carries parameters or not
	HideChildrenInMenu bool   `json:"hideChildrenInMenu" gorm:"comment:hide children menu or not"`             //  hide children menu or not
	Affix              bool   `json:"affix" gorm:"comment: affix tab"`                                         // affix tab
	DynamicLevel       uint32 `json:"dynamicLevel" gorm:"the maximum number of pages the router can open"`     // the maximum number of pages the router can open
	RealPath           string `json:"realPath" gorm:"comment:the real path of the route without dynamic part"` // the real path of the route without dynamic part
}

type Role

type Role struct {
	gorm.Model
	Name          string `json:"name" gorm:"comment:role name"`
	Value         string `json:"value" gorm:"unique;not null;comment: role value for permission control in front end"`
	DefaultRouter string `json:"defaultRouter" gorm:"comment:default menu;default:dashboard"` // default menu : dashboard
	Status        uint32 `json:"status" gorm:"default:0;comment:role status:0 normal, 1 ban"`
	Remark        string `json:"remark" gorm:"comment:remark"`
	OrderNo       uint32 `json:"orderNo" gorm:"default:0;comment:number for sorting"`
	Menus         []Menu `json:"menus" gorm:"many2many:role_menus"`
}

type User

type User struct {
	gorm.Model
	UUID        string `json:"uuid" gorm:"comment:user's UUID"`
	Username    string `json:"username" gorm:"unique;comment:user's login name'"`
	Password    string `json:"-"  gorm:"comment:password"`
	Nickname    string `json:"nickName" gorm:"unique;comment:nickname"`
	SideMode    string `json:"sideMode" gorm:"default:dark;comment:template mode"`
	Avatar      string `json:"Avatar" gorm:"comment:avatar"`
	BaseColor   string `json:"baseColor" gorm:"default:#fff;comment:base color of template"`
	ActiveColor string `json:"activeColor" gorm:"default:#1890ff;comment:active color of template"`
	RoleId      uint32 `json:"roleId" gorm:"default:2;comment:user's role id for access control"`
	Mobile      string `json:"mobile"  gorm:"comment:mobile number"`
	Email       string `json:"email"  gorm:"comment:email address"`
	Status      int32  `json:"status" gorm:"default:1;comment:user status 1: normal 2: ban"`
}

Jump to

Keyboard shortcuts

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