model

package
v0.0.0-...-e9d6abc Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FakeNow = func() time.Time { return time.Unix(2000000000, 0) }
)

Functions

func IF

func IF[V any](b bool, v1, v2 V) V

Types

type Address

type Address struct {
	Country   string
	State     string
	City      string
	Street    string
	Latitude  float64
	Longitude float64
}

type Credit

type Credit int8
const (
	CreditExcellent Credit = 3
	CreditGreat     Credit = 2
	CreditGood      Credit = 1
	CreditOK        Credit = 0
	CreditBad       Credit = -1
	CreditTerrible  Credit = -2
)

func (Credit) String

func (c Credit) String() string

type Device

type Device struct {
	Brand      string
	Platform   string
	OSVersion  string
	AppVersion string
}

type Gender

type Gender int8
const (
	GenderMale   Gender = 1
	GenderFemale Gender = 2
	GenderOther  Gender = 3
)

func (Gender) String

func (g Gender) String() string

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(seed int64) *Generator

func (*Generator) GenAddress

func (g *Generator) GenAddress() *Address

func (*Generator) GenDevice

func (g *Generator) GenDevice() *Device

func (*Generator) GenItem

func (g *Generator) GenItem() *Item

func (*Generator) GenItemPaymentFeatures

func (g *Generator) GenItemPaymentFeatures() *ItemPaymentFeatures

func (*Generator) GenUser

func (g *Generator) GenUser() *User

func (*Generator) GenUserPaymentFeatures

func (g *Generator) GenUserPaymentFeatures() *UserPaymentFeatures

type Item

type Item struct {
	ID               int64
	Name             string
	Category         string
	CategoryID       int64
	Discount         float64
	Rating           float64
	Status           uint8
	Price            float64
	WarehouseAddress *Address
	PaymentFeatures  *ItemPaymentFeatures
}

type ItemPaymentFeatures

type ItemPaymentFeatures struct {
	MtdCount   int64
	YtdCount   int64
	TotalCount int64

	CountPerAge    map[int]int64
	CountPerGender map[Gender]int64

	RatingPerAge    map[int]float64
	RatingPerGender map[Gender]float64

	PreferredAges    []int
	PreferredGenders []Gender
}

type User

type User struct {
	ID              int64
	Name            string
	Age             int
	BirthDate       time.Time
	Gender          Gender
	Address         *Address
	Language        string
	Interests       []string
	UserTags        []string
	CreatedAt       time.Time
	UpdatedAt       time.Time
	Credit          Credit
	CreditLimit     float64
	Discount        float64
	Balance         float64
	IsVip           bool
	IsStudent       bool
	CurrentDevice   *Device
	RecentDevices   []*Device
	PaymentFeatures *UserPaymentFeatures
}

type UserPaymentFeatures

type UserPaymentFeatures struct {
	MtdCount  int64
	MtdAmount float64

	YtdCount  int64
	YtdAmount float64

	AvgPrice    float64
	TotalCount  int64
	TotalAmount float64

	LatestPurchaseItem *Item
	LatestPurchasedAt  time.Time

	PreferCategoryIDs []int64
}

Jump to

Keyboard shortcuts

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