model

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultUserRole = []UserRole{
	{ID: 1, Code: 1, Name: "管理者", Permission: "{}"},
	{ID: 2, Code: 999, Name: "一般使用者", Permission: "{}"},
}

Functions

This section is empty.

Types

type User

type User struct {
	gorm.Model
	Account    string
	Password   string
	Name       string
	Email      string
	UserRoleID uint     `gorm:"index:users_user_roles_id_idx"`
	UserRole   UserRole `gorm:"constraint:OnUpdate:SET NULL,OnDelete:SET NULL;"`
}

func (*User) GetResponse

func (u *User) GetResponse() response.UserResponseListItem

type UserRole

type UserRole struct {
	ID         uint   `json:"id" example:"1"`
	Code       int    `gorm:"uniqueIndex" json:"code" example:"1"`
	Name       string `gorm:"uniqueIndex" json:"name" example:"管理者"`
	Permission string `json:"permission" example:"{}"`
}

Jump to

Keyboard shortcuts

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