products

package
v0.0.0-...-abc8f6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CreateProduct

func CreateProduct(w http.ResponseWriter, r *http.Request)

CreateProduct : Method for insert a product in DB

func DBConnect

func DBConnect()

DBConnect : Function for return a Mongo DB client

func GetProducts

func GetProducts(w http.ResponseWriter, r *http.Request)

GetProducts : Method for get all products in the DB

Types

type Product

type Product struct {
	//Id          primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Available   bool               `json:"disponible,omitempty" bson:"disponible,omitempty"`
	Name        string             `json:"nombre,omitempty" bson:"nombre,omitempty"`
	Description string             `json:"descripcion,omitempty" bson:"descripcion,omitempty"`
	Price       int32              `json:"precioUni,omitempty" bson:"precioUni,omitempty"`
	Category    primitive.ObjectID `json:"categoria,omitempty" bson:"categoria,omitempty"`
	User        primitive.ObjectID `json:"usuario,omitempty" bson:"usuario,omitempty"`
	Image       string             `json:"img,omitempty" bson:"img,omitempty"`
}

Product : Model for product struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL