entity

package
v0.0.0-...-04efeb6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleGuestUser  = 0
	RoleCommonUser = 1
	RoleAdminUser  = 10
	RoleRootUser   = 100
)
View Source
const (
	UserStatusEnabled  = 1 // don't use 0, 0 is the default value!
	UserStatusDisabled = 2 // also don't use 0
	UserStatusDeleted  = 3
)

Variables

This section is empty.

Functions

func MigrateDB

func MigrateDB(db *gorm.DB) error

Types

type Error

type Error struct {
	Message string `json:"message"`
	Type    string `json:"type"`
	Param   string `json:"param"`
	Code    any    `json:"code"`
}

type Option

type Option struct {
	Key   string `json:"key" gorm:"primaryKey"`
	Value string `json:"value"`
}

type Rule

type Rule struct {
	Key       int       `json:"key"`
	Disabled  bool      `json:"disabled"`
	Href      string    `json:"href"`
	Avatar    string    `json:"avatar"`
	Name      string    `json:"name"`
	Owner     string    `json:"owner"`
	Desc      string    `json:"desc"`
	CallNo    int       `json:"callNo"`
	Status    string    `json:"status"`
	UpdatedAt time.Time `json:"updatedAt"`
	CreatedAt time.Time `json:"createdAt"`
	Progress  int       `json:"progress"`
}

Rule 规则列表项

type User

type User struct {
	ID        uint   `json:"userid" gorm:"primaryKey"`
	Username  string `json:"name" gorm:"unique;index"`
	Password  string `json:"password" gorm:"not null;" validate:"min=8,max=20"`
	Avatar    string `json:"avatar" gorm:"type:varchar(255)"`
	Email     string `json:"email" gorm:"type:varchar(255)"`
	Phone     string `json:"phone" gorm:"type:varchar(255)"`
	Address   string `json:"address" gorm:"type:varchar(255)"`
	Group     string `json:"group" gorm:"type:varchar(255)"`
	Access    string `json:"access" gorm:"type:varchar(255)"`
	CreatedAt string `json:"createdAt" gorm:"autoCreateTime"`
	UpdatedAt string `json:"updatedAt" gorm:"autoUpdateTime"`
	Role      int    `json:"role" gorm:"type:int;default:1"`   // admin, util
	Status    int    `json:"status" gorm:"type:int;default:1"` // enabled, disabled
}

Jump to

Keyboard shortcuts

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