Documentation ¶
Overview ¶
A MongoDB integration package for Cloud Foundry.
Index ¶
- Variables
- func GetServiceBinding(serviceName string, serviceURIName string, appEnv *cfenv.App) (serviceURI string)
- type Collection
- type CollectionDialer
- type CollectionRepo
- func (s *CollectionRepo) Close()
- func (s *CollectionRepo) Count() (int, error)
- func (s *CollectionRepo) Find(params Params, result interface{}) (count int, err error)
- func (s *CollectionRepo) FindAndModify(selector interface{}, update interface{}, result interface{}) (info *mgo.ChangeInfo, err error)
- func (s *CollectionRepo) FindOne(id string, result interface{}) (err error)
- func (s *CollectionRepo) UpsertID(id interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
- func (s *CollectionRepo) Wake()
- type Params
Constants ¶
This section is empty.
Variables ¶
var ( //ErrInvalidID -- error for invalid id ErrInvalidID = errors.New("value is not a properly formatted hex string") )
Functions ¶
func GetServiceBinding ¶
func GetServiceBinding(serviceName string, serviceURIName string, appEnv *cfenv.App) (serviceURI string)
GetServiceBinding parses a *cfenv.App object and returns a URI for the specified service. (Refer to http://github.com/cloudfountry-community/go-cfenv for more details.)
Types ¶
type Collection ¶
type Collection interface { Wake() Close() Find(params Params, result interface{}) (count int, err error) 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 Connect ¶
func Connect(dialer CollectionDialer, URI string, collectionName string) (collection Collection)
Connect to the specified database and return a Collection object for the specified collection.
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) Count ¶
func (s *CollectionRepo) Count() (int, error)
Count -- counts the collection records
func (*CollectionRepo) Find ¶
func (s *CollectionRepo) Find(params Params, result interface{}) (count int, err error)
Find -- finds all records matching given selector
func (*CollectionRepo) FindAndModify ¶
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
Directories ¶
Path | Synopsis |
---|---|
Params will extract query parameters from the query string of a request into a RequestParams object.
|
Params will extract query parameters from the query string of a request into a RequestParams object. |
Wrap is a simple helper to wrap API response data and errors in a consistent structure.
|
Wrap is a simple helper to wrap API response data and errors in a consistent structure. |