model

package
v0.0.0-...-2551f53 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        int64      `json:"id" gorm:"column:id;" db:"id"`
	CreatedAt *time.Time `json:"created_at,omitempty" gorm:"column:created_at;" db:"created_at"`
	UpdatedAt *time.Time `json:"updated_at,omitempty" gorm:"column:updated_at;" db:"updated_at"`
}

type Brand

type Brand struct {
	Base
	Code            string `json:"code"`
	Name            string `json:"name"`
	Website         string `json:"website"`
	Active          bool   `json:"active"`
	Description     string `json:"description"`
	CreatorUsername string `json:"creator_username"`
}

type Cart

type Cart struct {
	Base
	Code          string              `json:"code" gorm:"column:code;"`
	Quantity      int64               `json:"quantity" gorm:"column:quantity;"`
	Weight        float64             `json:"weight" gorm:"column:weight;"`
	WeightUnit    constant.WeightUnit `json:"weight_unit" gorm:"column:weight_unit;default:KG;"`
	Total         float64             `json:"total" gorm:"column:total;"`
	Currency      constant.Currency   `json:"currency" gorm:"column:currency;default:USD;"`
	Note          string              `json:"note,omitempty" gorm:"column:note;"`
	Active        bool                `json:"active" gorm:"column:active;default:true;"`
	OwnerUsername string              `json:"owner_username" gorm:"column:owner_username;"`
}

func (Cart) TableName

func (Cart) TableName() string

type CartItem

type CartItem struct {
	CartID    int64             `json:"cart_id" gorm:"column:cart_id;"`
	ProductID int64             `json:"product_id" gorm:"column:product_id;"`
	Quantity  int64             `json:"quantity" gorm:"column:quantity;"`
	Price     float64           `json:"price" gorm:"column:price;"`
	Total     float64           `json:"total" gorm:"column:total;"`
	Currency  constant.Currency `json:"currency" gorm:"column:currency;default:USD;"`
	Note      string            `json:"note,omitempty" gorm:"column:note;"`
	CreatedAt *time.Time        `json:"created_at" gorm:"column:created_at;"`
}

func (CartItem) TableName

func (CartItem) TableName() string

type Category

type Category struct {
	Base
	ParentID        int64  `json:"parent_id"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	CreatorUsername string `json:"creator_username"`
}

type CreateProductParams

type CreateProductParams struct {
	Name        string  `json:"name" gorm:"column:name;" binding:"required"`
	Code        string  `json:"code,omitempty" gorm:"column:code;"`
	BrandID     int64   `json:"brand_id" gorm:"column:brand_id;"`
	CategoryID  int64   `json:"category_id" gorm:"column:category_id;"`
	Quantity    int64   `json:"quantity" gorm:"column:quantity;" binding:"required,min=0"`
	Weight      float64 `json:"weight" gorm:"column:weight;" binding:"required,gt=0"`
	WeightUnit  string  `json:"weight_unit" gorm:"column:weight_unit;default:KG;" binding:"required,weight_unit"`
	Price       float64 `json:"price" gorm:"column:price;" binding:"required,min=0"`
	Currency    string  `json:"currency" gorm:"column:currency;default:USD;" binding:"required,currency"`
	Description string  `json:"description,omitempty" gorm:"column:description;"`
	Slug        string  `json:"slug,omitempty" gorm:"column:slug;"`
}

func (CreateProductParams) TableName

func (CreateProductParams) TableName() string

type CreateUserParams

type CreateUserParams struct {
	Username string `json:"username" gorm:"column:username;" binding:"required"`
	Password string `json:"password" binding:"required"`
	FullName string `json:"full_name" gorm:"column:full_name;" binding:"required"`
	Email    string `json:"email" gorm:"column:email;" binding:"required"`
}

func (CreateUserParams) TableName

func (CreateUserParams) TableName() string

type LoginParams

type LoginParams struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

func (LoginParams) TableName

func (LoginParams) TableName() string

type ModifyCartItemParams

type ModifyCartItemParams struct {
	ProductID int64  `json:"product_id" binding:"required,min=1"`
	Quantity  int64  `json:"quantity" gorm:"column:quantity;" binding:"required,min=0"`
	Note      string `json:"note,omitempty" gorm:"column:note;"`
}

func (ModifyCartItemParams) TableName

func (ModifyCartItemParams) TableName() string

type Payment

type Payment struct {
	Base
	CartID        int64                  `json:"cart_id" gorm:"column:cart_id;"`
	Discount      float64                `json:"discount" gorm:"column:discount;"`
	Total         float64                `json:"total" gorm:"column:total;"`
	Currency      constant.Currency      `json:"currency" gorm:"column:currency;default:USD;"`
	Status        constant.PaymentStatus `json:"status" gorm:"column:status;default:PENDING;"`
	OwnerUsername string                 `json:"owner_username" gorm:"column:owner_username;"`
	Note          string                 `json:"note,omitempty" gorm:"column:note;"`
}

func (Payment) TableName

func (Payment) TableName() string

type Product

type Product struct {
	Base
	BrandID         int64                  `json:"brand_id" gorm:"column:brand_id;"`
	CategoryID      int64                  `json:"category_id" gorm:"column:category_id;"`
	Code            string                 `json:"code,omitempty" gorm:"column:code;"`
	Name            string                 `json:"name" gorm:"column:name;"`
	Quantity        int64                  `json:"quantity" gorm:"column:quantity;"`
	Weight          float64                `json:"weight" gorm:"column:weight;"`
	WeightUnit      constant.WeightUnit    `json:"weight_unit" gorm:"column:weight_unit;default:KG;"`
	Price           float64                `json:"price" gorm:"column:price;"`
	Currency        constant.Currency      `json:"currency" gorm:"column:currency;default:USD;"`
	Description     string                 `json:"description,omitempty" gorm:"column:description;"`
	Slug            string                 `json:"slug" gorm:"column:slug;"`
	Sold            int64                  `json:"sold" gorm:"column:sold;"`
	Rate            int64                  `json:"rate" gorm:"column:rate;"`
	Reviews         int64                  `json:"reviews" gorm:"column:reviews;"`
	Status          constant.ProductStatus `json:"status" gorm:"column:status;default:ACTIVE;"`
	OldStatus       string                 `json:"old_status" gorm:"column:old_status;"`
	CreatorUsername string                 `json:"creator_username" gorm:"column:creator_username;"`
	DeletedAt       *time.Time             `json:"deleted_at" gorm:"column:deleted_at;"`
}

func (Product) TableName

func (Product) TableName() string

type Session

type Session struct {
	ID           int64     `json:"id"`
	Username     string    `json:"username"`
	RefreshToken string    `json:"refresh_token"`
	UserAgent    string    `json:"user_agent"`
	ClientIp     string    `json:"client_ip"`
	IsBlocked    bool      `json:"is_blocked"`
	ExpiresAt    time.Time `json:"expires_at"`
	CreatedAt    time.Time `json:"created_at"`
}

type UpdateProductParams

type UpdateProductParams struct {
	Name        string  `json:"name" gorm:"column:name;" binding:"required"`
	Code        string  `json:"code,omitempty" gorm:"column:code;"`
	BrandID     int64   `json:"brand_id" gorm:"column:brand_id;"`
	CategoryID  int64   `json:"category_id" gorm:"column:category_id;"`
	Quantity    int64   `json:"quantity" gorm:"column:quantity;" binding:"required,min=0"`
	Weight      float64 `json:"weight" gorm:"column:weight;" binding:"required,gt=0"`
	WeightUnit  string  `json:"weight_unit" gorm:"column:weight_unit;default:KG;" binding:"required,weight_unit"`
	Price       float64 `json:"price" gorm:"column:price;" binding:"required,min=0"`
	Currency    string  `json:"currency" gorm:"column:currency;default:USD;" binding:"required,currency"`
	Description string  `json:"description,omitempty" gorm:"column:description;"`
	Slug        string  `json:"slug,omitempty" gorm:"column:slug;"`
}

func (UpdateProductParams) TableName

func (UpdateProductParams) TableName() string

type User

type User struct {
	Username          string    `json:"username" gorm:"column:username;"`
	HashedPassword    string    `json:"-" gorm:"column:hashed_password;"`
	Salt              string    `json:"-" gorm:"column:salt;"`
	FullName          string    `json:"full_name" gorm:"column:full_name;"`
	Email             string    `json:"email" gorm:"column:email;"`
	PasswordChangedAt time.Time `json:"password_changed_at" gorm:"column:password_changed_at;"`
	CreatedAt         time.Time `json:"created_at" gorm:"column:created_at;"`
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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