mongo

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	Collection string
	Database   string
	Session    *mgo.Session
	URI        string
}

Mongo represents a simplistic MongoDB configuration.

func (*Mongo) AddRecipe

func (m *Mongo) AddRecipe(item recipe.Response) error

AddRecipe adds a recipe document

func (*Mongo) GetRecipe

func (m *Mongo) GetRecipe(id string) (*recipe.Response, error)

GetRecipe retrieves a recipe document

func (*Mongo) GetRecipes

func (m *Mongo) GetRecipes(ctx context.Context) ([]recipe.Response, error)

GetRecipes retrieves all recipe documents from Mongo

func (*Mongo) Init

func (m *Mongo) Init() (session *mgo.Session, err error)

Init creates a new mgo.Session with a strong consistency and a write mode of "majority".

Jump to

Keyboard shortcuts

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