integrations

package
v0.0.93 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2015 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidID -- error for invalid id
	ErrInvalidID = errors.New("value is not a properly formatted hex string")
)

Functions

This section is empty.

Types

type Collection

type Collection interface {
	Wake()
	Close()
	FindOne(id string, result interface{}) (err error)
	UpsertID(selector interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
	FindAndModify(selector interface{}, update interface{}, target interface{}) (info *mgo.ChangeInfo, err error)
	Count() (int, error)
}

Collection - an interface representing a trimmed down collection object

func NewCollectionDialer

func NewCollectionDialer(url string, dbname string, collectionname string) (collection Collection, err error)

NewCollectionDialer -- dials a new mongo connection

type CollectionDialer

type CollectionDialer func(url string, dbname string, collectionname string) (collection Collection, err error)

CollectionDialer - a funciton type to dial for collections

type CollectionRepo

type CollectionRepo struct {
	Col *mgo.Collection
	// contains filtered or unexported fields
}

CollectionRepo - mgo collection adaptor

func (*CollectionRepo) Close

func (s *CollectionRepo) Close()

Close -- closes the connection

func (*CollectionRepo) Count

func (s *CollectionRepo) Count() (int, error)

Count -- counts the collection records

func (*CollectionRepo) FindAndModify added in v0.0.62

func (s *CollectionRepo) FindAndModify(selector interface{}, update interface{}, result interface{}) (info *mgo.ChangeInfo, err error)

FindAndModify -- execute a normal upsert

func (*CollectionRepo) FindOne

func (s *CollectionRepo) FindOne(id string, result interface{}) (err error)

FindOne -- finds record with given ID

func (*CollectionRepo) UpsertID

func (s *CollectionRepo) UpsertID(id interface{}, update interface{}) (info *mgo.ChangeInfo, err error)

UpsertID -- upserts the given object to the given id

func (*CollectionRepo) Wake

func (s *CollectionRepo) Wake()

Wake - will ping and reconnect if need be

Jump to

Keyboard shortcuts

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