entity

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	gorm.Model      `json:"-"`
	Title           string `gorm:"uniqueIndex"`
	Author          string `gorm:"index"`
	PublicationYear uint
	Genre           string `gorm:"index"`
	Description     string
	CoverImage      string
	Price           float64
}

type BookList

type BookList []Book

type BookSearchParams

type BookSearchParams struct {
	Title  WildcardString
	Author WildcardString
	Genre  WildcardString
}

type Cart

type Cart struct {
	gorm.Model
	UserId uint
	BookId uint
	Qty    uint
}

type CartResult

type CartResult struct {
	Cart
	Price float64
}

func (CartResult) TotalPrice

func (cr CartResult) TotalPrice() float64

type Order

type Order struct {
	gorm.Model
	UserId  uint `gorm:"index"`
	Status  uint
	Address string
	Price   float64
	Items   []OrderItem `gorm:"-"`
}

func (Order) TotalPrice

func (o Order) TotalPrice() float64

type OrderItem

type OrderItem struct {
	gorm.Model
	OrderId    uint `gorm:"index"`
	BookId     uint
	Qty        uint
	Price      float64
	TotalPrice float64
}

type OrderResult

type OrderResult struct {
	UserName       string
	UserEmail      string
	OrderId        uint
	OrderPrice     float64
	ItemName       string
	ItemPrice      float64
	ItemQty        uint
	ItemTotalPrice float64
}

type User

type User struct {
	gorm.Model `json:"-"`
	Name       string `gorm:"index"`
	Username   string `gorm:"uniqueIndex"`
	Email      string `gorm:"uniqueIndex"`
	Address    string
	Phone      string
}

type UserList

type UserList []User

type WildcardString

type WildcardString string

func (WildcardString) ToWildcard

func (ws WildcardString) ToWildcard() string

Jump to

Keyboard shortcuts

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