mysql

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLTransactionKey added in v1.0.0

type MySQLTransactionKey string

type MySQLUnitOfWork added in v1.0.0

type MySQLUnitOfWork struct {
	DB *sql.DB
}

func NewMySQLUnitOfWork added in v1.0.0

func NewMySQLUnitOfWork(DB *sql.DB) *MySQLUnitOfWork

func (MySQLUnitOfWork) Begin added in v1.0.0

func (muow MySQLUnitOfWork) Begin(ctx context.Context) (context.Context, error)

func (MySQLUnitOfWork) Commit added in v1.0.0

func (muow MySQLUnitOfWork) Commit(ctx context.Context) error

func (MySQLUnitOfWork) Rollback added in v1.0.0

func (muow MySQLUnitOfWork) Rollback(ctx context.Context) error

type OrderRepository

type OrderRepository struct {
	DB *sql.DB
}

func NewOrderRepository

func NewOrderRepository(DB *sql.DB) *OrderRepository

func (OrderRepository) Create

func (OrderRepository) CreateOrderItems added in v1.0.0

func (repo OrderRepository) CreateOrderItems(ctx context.Context, orderID int64, items []*entity.CreateOrderItemParam) error

func (OrderRepository) GetAllOrders

func (repo OrderRepository) GetAllOrders(ctx context.Context) ([]*entity.Order, error)

func (OrderRepository) GetAnnualIncome

func (repo OrderRepository) GetAnnualIncome(ctx context.Context) ([]*entity.AnnualIncome, error)

func (OrderRepository) GetDailyOrderCount

func (repo OrderRepository) GetDailyOrderCount(ctx context.Context) (int, error)

func (OrderRepository) GetLastDayIncome

func (repo OrderRepository) GetLastDayIncome(ctx context.Context) (int, error)

func (OrderRepository) GetLastMonthIncome

func (repo OrderRepository) GetLastMonthIncome(ctx context.Context) (int, error)

func (OrderRepository) GetOrderItemsByID

func (repo OrderRepository) GetOrderItemsByID(ctx context.Context, ID int64) ([]*entity.OrderItem, error)

func (OrderRepository) GetTotalOrderCount

func (repo OrderRepository) GetTotalOrderCount(ctx context.Context) (int, error)

type ProductRepository

type ProductRepository struct {
	DB *sql.DB
}

func NewProductRepository

func NewProductRepository(DB *sql.DB) *ProductRepository

func (ProductRepository) Create

func (ProductRepository) DecrementProductByIDs added in v1.0.0

func (repo ProductRepository) DecrementProductByIDs(ctx context.Context, IDDecrementMap map[int64]int) error

func (ProductRepository) DeleteByID

func (repo ProductRepository) DeleteByID(ctx context.Context, ID int64) (bool, error)

func (ProductRepository) GetAllProducts

func (repo ProductRepository) GetAllProducts(ctx context.Context) ([]*entity.Product, error)

func (ProductRepository) GetBestSellerProducts

func (repo ProductRepository) GetBestSellerProducts(ctx context.Context) ([]*entity.ProductSale, error)

func (ProductRepository) GetProductByCode

func (repo ProductRepository) GetProductByCode(ctx context.Context, code string) (*entity.Product, error)

func (ProductRepository) GetProductByID

func (repo ProductRepository) GetProductByID(ctx context.Context, ID int64) (*entity.Product, error)

func (ProductRepository) GetProductsByIDs

func (repo ProductRepository) GetProductsByIDs(ctx context.Context, IDs ...int64) ([]*entity.Product, error)

func (ProductRepository) UpdateByID

func (repo ProductRepository) UpdateByID(ctx context.Context, ID int64, param entity.UpdateProductParam) (bool, error)

type UserRepository

type UserRepository struct {
	DB *sql.DB
}

func NewUserRepository

func NewUserRepository(DB *sql.DB) *UserRepository

func (UserRepository) GetUserByEmail

func (repo UserRepository) GetUserByEmail(ctx context.Context, email string) (*entity.User, error)

func (UserRepository) GetUserByID

func (repo UserRepository) GetUserByID(ctx context.Context, ID int64) (*entity.User, error)

func (UserRepository) UpdateByID

func (repo UserRepository) UpdateByID(ctx context.Context, ID int64, param entity.UpdateUserParam) (bool, error)

func (UserRepository) UpdatePasswordByID

func (repo UserRepository) UpdatePasswordByID(ctx context.Context, ID int64, password string) (bool, error)

Jump to

Keyboard shortcuts

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