model

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 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 AdminUsers

type AdminUsers struct {
	Id        int32     `json:"id" gorm:"column:id;primaryKey;autoIncrement" validate:"required,numeric"`
	Username  string    `json:"username" gorm:"column:username" validate:"required,max=255"` // 用户名称
	Password  string    `json:"password" gorm:"column:password" validate:"required,max=255"` // 密码
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at" validate:"omitempty,datetime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at" validate:"omitempty,datetime"`
}

func NewAdminUsers

func NewAdminUsers() *AdminUsers

func (*AdminUsers) TableName

func (a *AdminUsers) TableName() string

type Policies

type Policies struct {
	Id         uint32    `json:"id" gorm:"column:id;primaryKey;autoIncrement" validate:"required,numeric"`
	RoleId     uint32    `json:"role_id" gorm:"column:role_id" validate:"required,numeric"`         // 角色id
	ResourceId uint32    `json:"resource_id" gorm:"column:resource_id" validate:"required,numeric"` // 资源id
	Action     string    `json:"action" gorm:"column:action" validate:"required,max=6"`             // 操作
	Effect     string    `json:"effect" gorm:"column:effect" validate:"required,max=5"`             // 影响:ALLOW-允许、DENY-拒绝
	CreatedAt  time.Time `json:"created_at" gorm:"column:created_at" validate:"omitempty,datetime"`
	UpdatedAt  time.Time `json:"updated_at" gorm:"column:updated_at" validate:"omitempty,datetime"`
}

func NewPolicies

func NewPolicies() *Policies

func (*Policies) TableName

func (p *Policies) TableName() string

type Resources

type Resources struct {
	Id        uint32    `json:"id" gorm:"column:id;primaryKey;autoIncrement" validate:"required,numeric"`
	Name      string    `json:"name" gorm:"column:name" validate:"required,max=255"` // 资源名称
	Type      uint8     `json:"type" gorm:"column:type" validate:"required,numeric"` // 资源类型
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at" validate:"omitempty,datetime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at" validate:"omitempty,datetime"`
}

func NewResources

func NewResources() *Resources

func (*Resources) TableName

func (r *Resources) TableName() string

type Roles

type Roles struct {
	Id        uint32    `json:"id" gorm:"column:id;primaryKey;autoIncrement" validate:"required,numeric"`
	Name      string    `json:"name" gorm:"column:name" validate:"required,max=255"` // 角色名称
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at" validate:"omitempty,datetime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at" validate:"omitempty,datetime"`
}

func NewRoles

func NewRoles() *Roles

func (*Roles) TableName

func (r *Roles) TableName() string

type User

type User struct {
	Id        int32     `json:"id" gorm:"column:id;primaryKey;autoIncrement" validate:"required,numeric"`
	Username  string    `json:"username" gorm:"column:username" validate:"required,max=100"` // 用户名称
	Password  string    `json:"password" gorm:"column:password" validate:"required,max=60"`  // 密码
	Avatar    string    `json:"avatar" gorm:"column:avatar" validate:"required,max=255"`     // 头像
	Phone     string    `json:"phone" gorm:"column:phone" validate:"required,max=11"`        // 电话号码
	Email     string    `json:"email" gorm:"column:email" validate:"required,max=255"`       // 邮箱
	Gender    uint8     `json:"gender" gorm:"column:gender" validate:"required,numeric"`     // 性别:0-未知、1-男、2-女
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at" validate:"omitempty,datetime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at" validate:"omitempty,datetime"`
}

func NewUser

func NewUser() *User

func (*User) TableName

func (u *User) TableName() string

type UserRoles

type UserRoles struct {
	UserId uint32 `json:"user_id" gorm:"column:user_id" validate:"required,numeric"`
	RoleId uint32 `json:"role_id" gorm:"column:role_id" validate:"required,numeric"`
}

func NewUserRoles

func NewUserRoles() *UserRoles

func (*UserRoles) TableName

func (u *UserRoles) TableName() string

Jump to

Keyboard shortcuts

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