documents

package
v0.0.0-...-8f3b465 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(db mongo.Database) (*mongo.Cursor, error)

Find returns a cursor pointin to all the produits in the db

Types

type Localisation

type Localisation struct {
	Adresse string `bson:"adresse"`
	Ville   string `bson:"ville"`
	Cp      string `bson:"cp"`
}

type Photo

type Photo struct {
	Url string `bson:"url"`
}

type PointRetrait

type PointRetrait struct {
	Nom          string        `bson:"nom"`
	Localisation *Localisation `bson:"localisation"`
}

type Produit

type Produit struct {
	ID          primitive.ObjectID `bson:"_id,omitempty"`
	Ref         string             `bson:"ref"`
	Description string             `bson:"description"`
	Prix        float32            `bson:"prix"`
	Photos      []*Photo           `bson:"photos"`
	Stocks      []*Stock           `bson:"stocks"`
	Tags        []string           `bson:"tags"`
}

func FromProduitPB

func FromProduitPB(produitProto *produitpb.Produit) (*Produit, error)

FromProduitPB parses a produit defined by the protobuff into a mongo produit document

func (*Produit) FindOne

func (produit *Produit) FindOne(db mongo.Database) error

FindOne returns the product with the specified ID from the database

func (*Produit) InsertOne

func (produit *Produit) InsertOne(db mongo.Database) (primitive.ObjectID, error)

InsertOne inserts one post in the database

func (*Produit) ToProduitPB

func (produit *Produit) ToProduitPB() *produitpb.Produit

ToProduitPB parses a mongo produit document into a produit defined by the protobuff

func (*Produit) Update

func (produit *Produit) Update(db mongo.Database) error

Update updates the specified produit within the database

type Stock

type Stock struct {
	PointRetrait *PointRetrait `bson:"pointRetrait"`
	Qte          int32         `bson:"qte"`
}

Jump to

Keyboard shortcuts

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