model

package
v0.0.0-...-905bf1f Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Types

type Ban

type Ban struct {
	ID      int64     `gorm:"primaryKey;unique;not null"`
	UserID  int64     `gorm:"unique;not null"`
	Reason  string    `gorm:"not null"`
	BanAt   time.Time `gorm:"not null"`
	UnbanAt time.Time `gorm:"not null"`
}

type Role

type Role struct {
	ID     int64  `gorm:"primaryKey;unique;not null"`
	UserID int64  `gorm:"not null"`
	Type   string `gorm:"not null"`
}

type User

type User struct {
	ID          int64  `gorm:"primaryKey;unique;not null"`
	Name        string `gorm:"not null"`
	Password    string `gorm:"type:varchar(256);not null"`
	Email       string `gorm:"unique;not null"`
	PhotoUrl    string `gorm:"not null"`
	Description string
	Ban         *Ban    `gorm:"foreignKey:UserID;references:ID"`
	Roles       []*Role `gorm:"foreignKey:UserID;not null;references:ID"`
}

func (*User) Create

func (u *User) Create(ctx context.Context) error

func (*User) Get

func (u *User) Get(ctx context.Context) error

func (*User) UpdateBan

func (u *User) UpdateBan(ctx context.Context) error

func (*User) UpdateInfo

func (u *User) UpdateInfo(ctx context.Context) error

Jump to

Keyboard shortcuts

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