items

package
v0.0.0-...-cda5c7b Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(iEnv *config.Data) httprouter.Handle

Create handler to create a new item

func CreateData

func CreateData(cl *mongo.Collection, i Item) primitive.ObjectID

CreateData creates a item and returns the create item

func Delete

func Delete(iEnv *config.Data) httprouter.Handle

Delete handler to delete a item

func DeleteData

func DeleteData(cl *mongo.Collection, id primitive.ObjectID) int64

DeleteData deletes the item of given id

func Edit

func Edit(iEnv *config.Data) httprouter.Handle

Edit handler to edit a existing item

func Get

func Get(iEnv *config.Data) httprouter.Handle

Get handler to get a especific item

func Index

func Index(iEnv *config.Data) httprouter.Handle

Index handler to show all items

func ModifyData

func ModifyData(cl *mongo.Collection, i []Item) primitive.ObjectID

ModifyData replace the item given on pos 0 from slice by the item on pos 1

Types

type Item

type Item struct {
	ID      primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Name    string             `json:"name,omitempty" bson:"name,omitempty"`
	Price   int8               `json:"price,omitempty" bson:"price,omitempty"`
	Visible bool               `json:"visible,omitempty" bson:"visible,omitempty"`
}

Item describe a basic menu item struct

func AllData

func AllData(cl *mongo.Collection) []Item

AllData returns a slice of Items

func OneData

func OneData(cl *mongo.Collection, id primitive.ObjectID) Item

OneData returns the item from a ObjectID

Jump to

Keyboard shortcuts

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