users

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB)

AutoMigrate 自动同步表结构

Types

type User

type User struct {
	models.BaseModel
	UserID   int64                     `gorm:"column:user_id;type:bigint;not null;index:,unique;comment:用户ID"`
	Nickname string                    `gorm:"column:nickname;type:varchar(30);comment:用户昵称"`
	Status   modelsEnum.UserStatusCode `gorm:"column:status;type:tinyint;default:0;comment:用户状态"`
	Wallet   Wallet                    `gorm:"foreignKey:user_id;references:user_id"`
	Orders   []orders.Order            `gorm:"foreignKey:user_id;references:user_id"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(_ *gorm.DB) (err error)

func (*User) BeforeUpdate

func (u *User) BeforeUpdate(_ *gorm.DB) (err error)

func (*User) Class

func (*User) Class() string

func (*User) TableName

func (*User) TableName() string

type Wallet

type Wallet struct {
	models.BaseModel
	UserID int64                       `gorm:"column:user_id;type:bigint;not null;index:,unique;comment:用户ID"`
	Amount float64                     `gorm:"column:amount;type:decimal(14,4);comment:余额"`
	Status modelsEnum.WalletStatusCode `gorm:"column:status;type:tinyint;default:0;comment:用户状态"`
}

func (*Wallet) BeforeCreate

func (w *Wallet) BeforeCreate(_ *gorm.DB) (err error)

func (*Wallet) BeforeUpdate

func (w *Wallet) BeforeUpdate(_ *gorm.DB) (err error)

func (*Wallet) Class

func (*Wallet) Class() string

func (Wallet) TableName

func (Wallet) TableName() string

Jump to

Keyboard shortcuts

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