carts

package
v0.0.0-...-d0fcf2f Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCartNotFound = errors.New("cart not found")
)

Functions

This section is empty.

Types

type Cart

type Cart struct {
	CartID    int        `json:"cart_id"`
	UserID    int        `json:"user_id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	Items     []CartItem `json:"items"`
}

type CartItem

type CartItem struct {
	CartItemID   int     `json:"cart_item_id"`
	CartID       int     `json:"cart_id"`
	ProductID    int     `json:"product_id"`
	Quantity     int     `json:"quantity"`
	Price        float64 `json:"price"`
	SessionID    string  `json:"session_id"`
	DiscountCode string  `json:"discount_code"`
	Total        float64 `json:"total"`
}

type CartRepository

type CartRepository interface {
	GetCarts(ctx context.Context) ([]*Cart, error)
	Save(ctx context.Context, cart *Cart) error
	FindByID(ctx context.Context, id int) (*Cart, error)
	Delete(ctx context.Context, id int) error
	Update(ctx context.Context, cart *Cart) error
}

Jump to

Keyboard shortcuts

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