cart

package
v0.0.0-...-e4a3b16 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cart

type Cart struct {
	ID         uint       `gorm:"id;primaryKey;autoIncrement"`
	UserID     uint       `gorm:"user_id"`
	TotalPrice int        `gorm:"total_price"`
	CreatedAt  time.Time  `gorm:"created_at"`
	UpdatedAt  time.Time  `gorm:"updated_at"`
	DeletedAt  *time.Time `gorm:"deleted_at"`
}

func (*Cart) ToCart

func (col *Cart) ToCart() cart.Cart

type CartProduct

type CartProduct struct {
	ID        uint       `gorm:"id;primaryKey;autoIncrement"`
	CartID    uint       `gorm:"cart_id"`
	ProductID uint       `gorm:"product_id"`
	Count     int        `gorm:"count"`
	Price     int        `gorm:"price"`
	CreatedAt time.Time  `gorm:"created_at"`
	UpdatedAt time.Time  `gorm:"updated_at"`
	DeletedAt *time.Time `gorm:"deleted_at"`
}

func (*CartProduct) ToCartProduct

func (col *CartProduct) ToCartProduct() cart.CartProduct

type GormRepository

type GormRepository struct {
	DB *gorm.DB
}

func NewGormDBRepository

func NewGormDBRepository(db *gorm.DB) *GormRepository

func (*GormRepository) CreateCart

func (repo *GormRepository) CreateCart(cart cart.Cart) (*cart.Cart, error)

func (*GormRepository) CreateCartProduct

func (repo *GormRepository) CreateCartProduct(cartProduct cart.CartProduct) (*cart.CartProduct, error)

func (*GormRepository) FindCartByUserID

func (repo *GormRepository) FindCartByUserID(id int) (*cart.Cart, error)

func (*GormRepository) FindCartProduct

func (repo *GormRepository) FindCartProduct(cartID int, productID int) (*cart.CartProduct, error)

func (*GormRepository) FindCartProductByCart

func (repo *GormRepository) FindCartProductByCart(cartID int) ([]cart.CartProduct, error)

func (*GormRepository) SumPrice

func (repo *GormRepository) SumPrice(cartID int) int

func (*GormRepository) UpdateCart

func (repo *GormRepository) UpdateCart(cart cart.Cart) (*cart.Cart, error)

func (*GormRepository) UpdateCartProduct

func (repo *GormRepository) UpdateCartProduct(cartProduct cart.CartProduct) (*cart.CartProduct, error)

type SumPrice

type SumPrice struct {
	SumPrice int `gorm:"sum_price"`
}

Jump to

Keyboard shortcuts

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