mysql

package
v0.0.0-...-5b790e6 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeys

func GetKeys(m map[int]int) []int

func Pepper_Pass

func Pepper_Pass(password string) []byte

Types

type CartService

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

func NewCartService

func NewCartService(db *DB) *CartService

func (*CartService) AddProductToCart

func (cs *CartService) AddProductToCart(ctx context.Context, pid int, quantity int) error

func (*CartService) Checkout

func (cs *CartService) Checkout(ctx context.Context) error

func (*CartService) ClearCart

func (cs *CartService) ClearCart(ctx context.Context) error

func (*CartService) GetCart

func (cs *CartService) GetCart(ctx context.Context) (*entity.Cart, error)

func (*CartService) ModifyCart

func (cs *CartService) ModifyCart(ctx context.Context, pid int, quantity int) (cart *entity.Cart, err error)

func (*CartService) RemoveProductFromCart

func (cs *CartService) RemoveProductFromCart(ctx context.Context, pid int) error

func (*CartService) Total

func (cs *CartService) Total(ctx context.Context) (int, error)

type DB

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

func NewDB

func NewDB() *DB

func (*DB) BeginTx

func (db *DB) BeginTx(opts *sql.TxOptions) (*Tx, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) OpenDB

func (db *DB) OpenDB() error

type InventoryService

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

func NewInventoryService

func NewInventoryService(db *DB) *InventoryService

func (*InventoryService) AddStockToInventory

func (is *InventoryService) AddStockToInventory(ctx context.Context, id int, quantity int) error

func (*InventoryService) GetAllStocksFromInventory

func (is *InventoryService) GetAllStocksFromInventory(ctx context.Context) ([]*entity.Stock, error)

func (*InventoryService) GetStockFromInventory

func (is *InventoryService) GetStockFromInventory(ctx context.Context, id int) (*entity.Stock, error)

func (*InventoryService) RemoveStockFromInventory

func (is *InventoryService) RemoveStockFromInventory(ctx context.Context, id int) error

func (*InventoryService) UpdateStockInInventory

func (is *InventoryService) UpdateStockInInventory(ctx context.Context, id int, quantity int) error

type OrderService

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

func NewOrderService

func NewOrderService(db *DB) *OrderService

func (*OrderService) CreateOrder

func (os *OrderService) CreateOrder(ctx context.Context, products []entity.Stock, total int) (*entity.Order, error)

func (*OrderService) DeleteOrder

func (os *OrderService) DeleteOrder(ctx context.Context, id int) error

func (*OrderService) GetAllOrders

func (os *OrderService) GetAllOrders(ctx context.Context) ([]entity.Order, error)

func (*OrderService) GetOrder

func (os *OrderService) GetOrder(ctx context.Context, id int) (*entity.Order, error)

func (*OrderService) GetOrders

func (os *OrderService) GetOrders(ctx context.Context, ids []int) ([]entity.Order, error)

func (*OrderService) GetOrdersOfUser

func (os *OrderService) GetOrdersOfUser(ctx context.Context, uid int) ([]entity.Order, error)

type ProductService

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

func NewProductService

func NewProductService(db *DB) *ProductService

func (*ProductService) CreateProduct

func (ps *ProductService) CreateProduct(ctx context.Context, name string, description string, price int, seller string, images []string) (*entity.Product, error)

func (*ProductService) DeleteProduct

func (ps *ProductService) DeleteProduct(ctx context.Context, id int) error

func (*ProductService) GetAllProducts

func (ps *ProductService) GetAllProducts(ctx context.Context) ([]entity.Product, error)

func (*ProductService) GetProduct

func (ps *ProductService) GetProduct(ctx context.Context, id int) (*entity.Product, error)

func (*ProductService) GetProducts

func (ps *ProductService) GetProducts(ctx context.Context, ids []int) ([]entity.Product, error)

func (*ProductService) UpdateProduct

func (ps *ProductService) UpdateProduct(ctx context.Context, update entity.Product) (*entity.Product, error)

type Tx

type Tx struct {
	*sql.Tx
	// contains filtered or unexported fields
}

type UserService

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

func NewUserService

func NewUserService(db *DB) *UserService

func (*UserService) AuthenticateUser

func (us *UserService) AuthenticateUser(ctx context.Context, email string, password string) (*entity.User, error)

func (*UserService) CreateUser

func (us *UserService) CreateUser(ctx context.Context, name string, email string, password string) (*entity.User, error)

func (*UserService) GetUserByEmail

func (us *UserService) GetUserByEmail(ctx context.Context, email string) (*entity.User, error)

func (*UserService) GetUserByID

func (us *UserService) GetUserByID(ctx context.Context, id int) (*entity.User, error)

Jump to

Keyboard shortcuts

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