The database layer

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) ...

Get Hands-On Full Stack Development with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.