Documentation
¶
Index ¶
- type Database
- type PostgresDB
- func (db *PostgresDB) Close() error
- func (db *PostgresDB) CreateCustomer(customer *models.Customer) error
- func (db *PostgresDB) CreateOrder(order *models.Order) error
- func (db *PostgresDB) CreateProduct(product *models.Product) error
- func (db *PostgresDB) GetAllCustomers() ([]models.Customer, error)
- func (db *PostgresDB) GetCustomerByEmail(email string) (*models.Customer, error)
- func (db *PostgresDB) GetCustomerByID(id uint) (models.Customer, error)
- func (db *PostgresDB) GetOrderByID(orderID uint) (models.Order, error)
- func (db *PostgresDB) GetProductsByIDs(productIDs []uint) ([]models.Product, error)
- func (db *PostgresDB) IsPreviousOrderUnfulfilled(customerID uint) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface {
Close() error
GetAllCustomers() ([]models.Customer, error)
GetCustomerByID(uint) (models.Customer, error)
GetProductsByIDs([]uint) ([]models.Product, error)
CreateOrder(*models.Order) error
GetOrderByID(uint) (models.Order, error)
IsPreviousOrderUnfulfilled(uint) (bool, error)
CreateCustomer(customer *models.Customer) error
GetCustomerByEmail(string) (*models.Customer, error)
CreateProduct(*models.Product) error
}
func ConnectDatabase ¶
func ConnectDatabase(cfg *config.DatabaseConfig) (Database, error)
type PostgresDB ¶
func (*PostgresDB) Close ¶
func (db *PostgresDB) Close() error
func (*PostgresDB) CreateCustomer ¶
func (db *PostgresDB) CreateCustomer(customer *models.Customer) error
func (*PostgresDB) CreateOrder ¶
func (db *PostgresDB) CreateOrder(order *models.Order) error
func (*PostgresDB) CreateProduct ¶
func (db *PostgresDB) CreateProduct(product *models.Product) error
func (*PostgresDB) GetAllCustomers ¶
func (db *PostgresDB) GetAllCustomers() ([]models.Customer, error)
func (*PostgresDB) GetCustomerByEmail ¶
func (db *PostgresDB) GetCustomerByEmail(email string) (*models.Customer, error)
func (*PostgresDB) GetCustomerByID ¶
func (db *PostgresDB) GetCustomerByID(id uint) (models.Customer, error)
func (*PostgresDB) GetOrderByID ¶
func (db *PostgresDB) GetOrderByID(orderID uint) (models.Order, error)
func (*PostgresDB) GetProductsByIDs ¶
func (db *PostgresDB) GetProductsByIDs(productIDs []uint) ([]models.Product, error)
func (*PostgresDB) IsPreviousOrderUnfulfilled ¶
func (db *PostgresDB) IsPreviousOrderUnfulfilled(customerID uint) (bool, error)
Click to show internal directories.
Click to hide internal directories.