mongostorage

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoStorage

type MongoStorage struct {
	DefaultPaginationParams *storer.PaginationParams
	// contains filtered or unexported fields
}

MongoStorage holds session and dial info of MongoDB connection

func NewMongoStorage

func NewMongoStorage(uri string) (*MongoStorage, error)

NewMongoStorage returns a new MongoStorage with an active session

func (*MongoStorage) Aggregate

func (s *MongoStorage) Aggregate(collection string, query interface{}, result interface{}) error

Aggregate aggregate object(s) directly from dbms

func (*MongoStorage) Close

func (s *MongoStorage) Close() error

Close connection

func (*MongoStorage) Count

func (s *MongoStorage) Count(collection string, query interface{}) (int, error)

Count retrieves object count directly from dbms

func (*MongoStorage) Create

func (s *MongoStorage) Create(collection string, object interface{}) error

Create inserts given object to store

func (*MongoStorage) CreateMany

func (s *MongoStorage) CreateMany(collection string, query []interface{}) error

func (*MongoStorage) Delete

func (s *MongoStorage) Delete(collection string, query interface{}) error

Delete remove object with given id from store

func (*MongoStorage) DeleteMany

func (s *MongoStorage) DeleteMany(collection string, query interface{}) error

func (*MongoStorage) EnsureIndex

func (s *MongoStorage) EnsureIndex(collection string, index mgo.Index) error

EnsureIndex is set index to mongodb

func (*MongoStorage) Find

func (s *MongoStorage) Find(collection string, query interface{}, result interface{}, pagination *storer.PaginationParams) error

Find returns all matching documents with query and pagination params

func (*MongoStorage) FindOne

func (s *MongoStorage) FindOne(collection string, query interface{}, result interface{}) error

FindOne returns matching document

func (*MongoStorage) NewPaginationParams

func (s *MongoStorage) NewPaginationParams() *storer.PaginationParams

NewPaginationParams returns default pagination params

func (*MongoStorage) Update

func (s *MongoStorage) Update(collection string, query interface{}, change interface{}) error

Update updates record with given object

func (*MongoStorage) UpdateMany

func (s *MongoStorage) UpdateMany(collection string, query interface{}, change interface{}) error

func (*MongoStorage) UpdateWithOptions

func (s *MongoStorage) UpdateWithOptions(collection string, query interface{}, change interface{}, options interface{}) error

UpdateWithOptions updates record with given object

type MongoStorageOfficial

type MongoStorageOfficial struct {
	DefaultPaginationParams *storer.PaginationParams
	// contains filtered or unexported fields
}

MongoStorage holds session and dial info of MongoDB connection

func NewMongoStorageOfficial

func NewMongoStorageOfficial(uri string, newRelicApp *newrelic.Application) (*MongoStorageOfficial, error)

NewMongoStorage returns a new MongoStorage with an active session

func (*MongoStorageOfficial) Aggregate

func (s *MongoStorageOfficial) Aggregate(collectionName string, query interface{}, result interface{}) error

Aggregate aggregate object(s) directly from dbms

func (*MongoStorageOfficial) Close

func (s *MongoStorageOfficial) Close() error

Close connection

func (*MongoStorageOfficial) Count

func (s *MongoStorageOfficial) Count(collectionName string, query interface{}) (int, error)

Count retrieves object count directly from dbms

func (*MongoStorageOfficial) Create

func (s *MongoStorageOfficial) Create(collectionName string, object interface{}) error

Create inserts given object to store

func (*MongoStorageOfficial) CreateMany

func (s *MongoStorageOfficial) CreateMany(collectionName string, objects []interface{}) error

Create inserts given list of object to store

func (*MongoStorageOfficial) Delete

func (s *MongoStorageOfficial) Delete(collectionName string, query interface{}) error

Delete remove object with given id from store

func (*MongoStorageOfficial) DeleteMany

func (s *MongoStorageOfficial) DeleteMany(collectionName string, query interface{}) error

Delete remove object with given list of ids from store

func (*MongoStorageOfficial) Find

func (s *MongoStorageOfficial) Find(collectionName string, query interface{}, result interface{}, pagination *storer.PaginationParams) error

Find returns all matching documents with query and pagination params

func (*MongoStorageOfficial) FindOne

func (s *MongoStorageOfficial) FindOne(collectionName string, query interface{}, result interface{}) error

FindOne returns matching document

func (*MongoStorageOfficial) NewPaginationParams

func (s *MongoStorageOfficial) NewPaginationParams() *storer.PaginationParams

NewPaginationParams returns default pagination params

func (*MongoStorageOfficial) Update

func (s *MongoStorageOfficial) Update(collectionName string, query interface{}, change interface{}) error

Update updates record with given object

func (*MongoStorageOfficial) UpdateMany

func (s *MongoStorageOfficial) UpdateMany(collectionName string, query interface{}, change interface{}) error

Update updates record with given lis of object object

func (*MongoStorageOfficial) UpdateWithOptions

func (s *MongoStorageOfficial) UpdateWithOptions(collection string, query interface{}, change interface{}, options interface{}) error

UpdateWithOptions updates record with given object - not implemented because of official mongo driver has not method like this

Jump to

Keyboard shortcuts

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