model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithIDEq

func WithIDEq(id string) func(*gorm.DB) *gorm.DB

func WithNameLike

func WithNameLike(name string) func(*gorm.DB) *gorm.DB

func WithRoleEq

func WithRoleEq(role user.Role) func(*gorm.DB) *gorm.DB

func WithStatusEq

func WithStatusEq(status user.Status) func(*gorm.DB) *gorm.DB

Types

type User

type User struct {
	ID             string `gorm:"primaryKey;type:char(32);index:,type:hash" json:"id"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Username       string      `gorm:"not null;uniqueIndex;type:varchar(32)"`
	HashedPassword []byte      `gorm:"not null"`
	Role           user.Role   `gorm:"not null;default:0"`
	Status         user.Status `gorm:"not null;default:0"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

Jump to

Keyboard shortcuts

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