model

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Model

	UUID     uuid.UUID `json:"uuid" gorm:"index;unique;comment:用户UUID"`
	Username string    `json:"username" gorm:"size:16;index;unique;comment:用户账号"`
	Password string    `json:"-" gorm:"size:64;comment:用户密码"`
	Nickname string    `json:"nickname" gorm:"size:16;comment:用户昵称"`
	Phone    string    `json:"phone" gorm:"size:16;comment:用户手机号"`
	Status   int       `json:"status" gorm:"default:1;comment:用户状态"`
	Roles    []Role    `json:"roles" gorm:"many2many:sys_account_roles"`
}

func (*Account) BeforeCreate

func (a *Account) BeforeCreate(db *gorm.DB) (err error)

func (Account) TableName

func (Account) TableName() string

func (*Account) Verify

func (a *Account) Verify(pswd string) bool
type Menu struct {
	Model

	UUID   uuid.UUID `json:"uuid" gorm:"index;unique;comment:UUID"`
	Link   string    `json:"link" gorm:"size:256;comment:链接"`
	Perm   string    `json:"perm" gorm:"size:64;comment:权限值"`
	Name   string    `json:"name" gorm:"size:16;comment:名称"`
	Group  string    `json:"group" gorm:"size:32;comment:分组"`
	Pos    string    `json:"pos" gorm:"size:16;comment:位置"`
	Icon   string    `json:"icon" gorm:"size:32;comment:图标"`
	Auth   int       `json:"auth" gorm:"default:0;comment:认证"`
	Status int       `json:"status" gorm:"default:1;comment:状态"`
}
func (m *Menu) BeforeCreate(tx *gorm.DB) (err error)
func (Menu) TableName() string

type Model

type Model struct {
	ID        uint           `json:"-" gorm:"primarykey;comment:ID"`
	CreatedAt time.Time      `json:"createdAt" gorm:"comment:创建时间"`
	UpdatedAt time.Time      `json:"updatedAt" gorm:"comment:更新时间"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"`
}

type Perm

type Perm struct {
	Model

	Value string `json:"value" gorm:"size:64;index;unique;comment:权限值"`
	Group string `json:"group" gorm:"size:32;comment:权限组"`
	Desc  string `json:"desc" gorm:"size:32;comment:权限描述"`
}

func (Perm) TableName

func (Perm) TableName() string

type Role

type Role struct {
	Model

	UUID   uuid.UUID `json:"uuid" gorm:"index;unique;comment:角色UUID"`
	Name   string    `json:"name" gorm:"size:16;unique;comment:角色名称"`
	Desc   string    `json:"desc" gorm:"size:256;comment:角色描述"`
	Status int       `json:"status" gorm:"default:1;comment:角色状态"`

	Perms []RolePerm `json:"perms" gorm:"foreignKey:RoleId;references:UUID"`
}

func (*Role) BeforeCreate

func (a *Role) BeforeCreate(tx *gorm.DB) (err error)

func (Role) TableName

func (Role) TableName() string

type RolePerm

type RolePerm struct {
	Model

	RoleId uuid.UUID `json:"uuid" gorm:"index;comment:角色UUID"`
	Perm   string    `json:"perm" gorm:"size:64;comment:权限值"`
}

func (RolePerm) TableName

func (RolePerm) TableName() string

Jump to

Keyboard shortcuts

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