Now, we have to implement the functionality of our database layer.
In the previous chapter, we designed a database layer interface that defined all of the database operations we are expected to need. This is what it 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)}
In our project folder, let's create a new file ...