In the previous chapter, we started writing our database layer. As a reminder, our database layer was hosted in the backend\src\dblayer folder. Our first step was to write the database layer interface, which defined all of the functionality that we expect from the database layer. This is what the database layer interface looked like:
type DBLayer interface {
GetAllProducts() ([]models.Product, error)
GetPromos() ([]models.Product, error)
GetCustomerByName(string, string) (models.Customer, error)
GetCustomerByID(int) (models.Customer, error)
GetProduct(int) (models.Product, error)
AddUser(models.Customer) (models.Customer, error)
SignInUser(username, password string) (models.Customer, error)
SignOutUserById(int) error
GetCustomerOrdersByID(int) ([]models.Order, error)
}
Now, we need to implement these methods to get some solid functionality in our database...