Documentation ¶
Index ¶
- Variables
- func Create(product models.Product) (string, error)
- func CreateProduct(product models.Product) (string, error)
- func Delete(productID string) error
- func DeleteProduct(productID string) error
- func GetAll() ([]models.Product, error)
- func GetAllProducts() ([]models.Product, error)
- func GetByID(id string) (models.Product, error)
- func GetByType(_type string) ([]models.Product, error)
- func GetProductByID(id string) (models.Product, error)
- func GetProductsWithType(_type string) ([]models.Product, error)
- func InitCollections()
- func InitMongoDB(uri string)
Constants ¶
This section is empty.
Variables ¶
View Source
var Client *mongo.Client
View Source
var Collection *mongo.Collection
Assume you have a collection named "products"
Functions ¶
func CreateProduct ¶
Create function to add products
func GetAllProducts ¶
Get function to get all products
func GetProductByID ¶
Get function to get product by id
func GetProductsWithType ¶
Get function to get all products that have the given type
func InitCollections ¶
func InitCollections()
func InitMongoDB ¶
func InitMongoDB(uri string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.