model

package
v0.0.0-...-afa0789 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Good

type Good struct {
	UUIDColumn
	Code        string    `gorm:"column:code;type:varchar(10);not null;unique"`
	Name        string    `gorm:"column:name;type:varchar(20);not null"`
	Description string    `gorm:"column:description"`
	IsActive    bool      `gorm:"column:is_active;default:1"`
	GoodStock   GoodStock `gorm:"foreignKey:GoodID"`
	TimestampColumn
}

func (Good) BeforeCreate

func (m Good) BeforeCreate(tx *gorm.DB) (err error)

type GoodSnapShotColumn

type GoodSnapShotColumn struct {
	GoodSnapShot datatypes.JSON `gorm:"column:good_snapshot;default:'{}'"`
}

func (*GoodSnapShotColumn) ParseGoodSnapshot

func (m *GoodSnapShotColumn) ParseGoodSnapshot() (b []byte, err error)

type GoodStock

type GoodStock struct {
	ID     uint   `gorm:"column:id;primaryKey"`
	Total  int    `gorm:"column:total;default:0"`
	GoodID string `gorm:"column:good_id"`
	TimestampColumn
}

type Order

type Order struct {
	UUIDColumn
	RequestAt time.Time `gorm:"column:request_at"`
	Total     int       `gorm:"column:total"`
	Type      int       `gorm:"column:type"`
	GoodSnapShotColumn
	TimestampColumn
	OrderItem []*OrderItem `gorm:"foreignKey:OrderID"`
	CountItem int          `gorm:"column:count_item"`
}

func (Order) BeforeCreate

func (m Order) BeforeCreate(tx *gorm.DB) (err error)

func (Order) GetOrderTypeName

func (m Order) GetOrderTypeName() string

func (*Order) ParseGoodSnapshot

func (m *Order) ParseGoodSnapshot() (b []byte, err error)

type OrderItem

type OrderItem struct {
	UUIDColumn
	OrderID string `gorm:"column:order_id"`
	Order   Order  `gorm:"foreignKey:OrderID"`
	Total   int    `gorm:"column:total"`
	GoodID  string `gorm:"column:good_id"`
	GoodSnapShotColumn
	TimestampColumn
}

func (OrderItem) BeforeCreate

func (m OrderItem) BeforeCreate(tx *gorm.DB) (err error)

type TimestampColumn

type TimestampColumn struct {
	CreatedAt time.Time `gorm:"column:created_at"`
	UpdatedAt time.Time `gorm:"column:updated_at"`
}

type UUIDColumn

type UUIDColumn struct {
	ID string `gorm:"column:id;type:varchar(36);not null;primaryKey"`
}

func GenerateUUID

func GenerateUUID() UUIDColumn

type User

type User struct {
	UUIDColumn
	FullName string `gorm:"column:fullName"`
	Email    string `gorm:"column:email"`
	Password string `gorm:"column:password"`
	TimestampColumn
}

func (User) BeforeCreate

func (m User) BeforeCreate(tx *gorm.DB) (err error)

Jump to

Keyboard shortcuts

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