model

package
v0.0.0-...-250bc44 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetWithGreaterCreateTime

func GetWithGreaterCreateTime(time int64) func(db *gorm.DB) *gorm.DB

func GetWithId

func GetWithId(id int64) func(db *gorm.DB) *gorm.DB

func GetWithLessThanCreateTime

func GetWithLessThanCreateTime(time int64) func(db *gorm.DB) *gorm.DB

func GetWithOnSale

func GetWithOnSale(state ProductState) func(db *gorm.DB) *gorm.DB

Types

type Product

type Product struct {
	Id          int64        `gorm:"column:id" json:"id"`
	Title       string       `gorm:"column:title" json:"title"`
	Description string       `gorm:"column:description" json:"description"`
	Image       string       `gorm:"column:image" json:"image"`
	OnSale      uint32       `gorm:"column:on_sale" json:"onSale"`
	SoldCount   uint32       `gorm:"column:sold_count" json:"soldCount"`
	Price       uint32       `gorm:"column:price" json:"price"`
	CreatedAt   int64        `gorm:"column:created_at;autoCreatedAt" json:"createdAt"`
	UpdatedAt   int64        `gorm:"column:updated_at;autoUpdatedAt" json:"updatedAt"`
	Skus        []ProductSku `gorm:"foreignKey:product_id"`
}

func (Product) TableName

func (Product) TableName() string

type ProductSku

type ProductSku struct {
	Id        uint64 `gorm:"column:id" json:"id"`
	Title     string `gorm:"column:title" json:"title"`
	Price     uint32 `gorm:"column:price" json:"price"`
	Stock     uint32 `gorm:"column:stock" json:"stock"`
	ProductId uint64 `gorm:"column:product_id" json:"productId"`
	CreatedAt int64  `gorm:"column:created_at;autoCreatedAt" json:"createdAt"`
	UpdatedAt int64  `gorm:"column:updated_at;autoUpdatedAt" json:"updatedAt"`
}

func (ProductSku) TableName

func (ProductSku) TableName() string

type ProductState

type ProductState uint32
const (
	ProductInSale ProductState = iota + 1
	ProductNotSale
)

Jump to

Keyboard shortcuts

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