mongo

package
v0.0.0-...-905ac89 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2018 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("object(s) not found")

ErrNotFound is used when the object(s) was not found

View Source
var ErrUnavailable = errors.New("database or collection is unavailable")

ErrUnavailable is used when the database or collection is unavailable

Functions

This section is empty.

Types

type BasicRepository

type BasicRepository interface {
	GetByID(ctx context.Context, id objectid.ObjectID, result interface{}) error
	Find(ctx context.Context, filter interface{}, result interface{}) error
	FindOne(ctx context.Context, filter interface{}, result interface{}) error
	UpdateByID(ctx context.Context, id objectid.ObjectID, document interface{}) error
	Update(ctx context.Context, filter interface{}, document interface{}) error
	UpsertByID(ctx context.Context, id objectid.ObjectID, document interface{}) error
	Upsert(ctx context.Context, filter interface{}, document interface{}) error
	Store(ctx context.Context, document interface{}) (*objectid.ObjectID, error)
	DeleteByID(ctx context.Context, id objectid.ObjectID) error
	Delete(ctx context.Context, filter interface{}) error
	Count(ctx context.Context, filter interface{}) (int64, error)
}

BasicRepository is a Repository with common database logic

func NewRepository

func NewRepository(collection Collection) BasicRepository

NewRepository creates a new MongoDB Repository from a MongoDB collection with the BasicRepository type

type Collection

type Collection string

Collection is the type for Database Collections

Jump to

Keyboard shortcuts

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