March 2019
Beginner to intermediate
324 pages
7h 17m
English
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) ...Read now
Unlock full access