mongo

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save added in v0.0.2

func Save(db, collection, url string, ctx context.Context, data interface{}) error

Save saves given one entity into db.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func NewDriver

func NewDriver(url string) (*Driver, error)

NewDriver returns new mongodb client.

func (*Driver) Collection

func (d *Driver) Collection(db, collection string) *mongo.Collection

Collection returns mongo collection ineterface based on given db and collection.

func (*Driver) Start

func (d *Driver) Start(ctx context.Context) error

Start connects the driver to mongo server.

func (*Driver) Stop

func (d *Driver) Stop(ctx context.Context)

Stop disconnects the driver to mongo server. Not return error (only logging) since easy to use for defer function.

Jump to

Keyboard shortcuts

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