Documentation
¶
Overview ¶
The mongodbrelation package implements a Juju mongodb relation.
Importing this package also registers the type *mgo.Session with the httpservice package, so that it can be used as a relation field with httpservice.Service.Register.
For example, to register a web service that requires a MongoDB connection, you might do something like this:
type relations struct { Session *mgo.Session `httpservice:"mongodb"` } func RegisterHooks(r *hook.Registry) { var svc httpservice.Service svc.Register(r, "somename", "http", func(_ struct{}, rel *relations) (httpservice.Handler, error) { // rel.Session contains the actual MongoDB connection. return newHandler(rel) }) }
This would create a Juju requirer relation named "mongodb" and dial the related MongoDB instance before creating the HTTP handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Requirer ¶
type Requirer struct {
// contains filtered or unexported fields
}
Requirer represents the requirer side of an mongodb relation.