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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.