Progress documentation of my first golang API
- Custom errors;
- Error handling;
- Connection with database (PostgreSQL)
- Migrations (Goose)
- Unit tests;
- Integration tests;
- Logging;
- Swagger/Open API documentation;
- Benchmark;
This project is a simple Go application designed to manage products and their stock levels. It consists of two primary data structures: Product and Stock.
Product
The Product struct represents an individual product in the inventory. It contains the following fields:
type Product struct {
Id int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Price float64 `json:"price"`
}
Stock
The Stock struct represents the stock level of a product. It contains the following fields:
type Stock struct {
Id int `json:"id"`
Product_id int `json:"product_id"`
Quantity int `json:"quantity"`
}