Documentation ¶
Index ¶
Constants ¶
const (
Name = "MongoDB"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnManager ¶
type ConnManager struct { sync.Mutex Destroy context.CancelFunc // contains filtered or unexported fields }
ConnManager is thread-safe structure for manage connections.
type MongoCollection ¶
type MongoCollection struct {
*mongo.Collection
}
MongoCollection wraps a mongo.Collection to embed methods in models.
func (*MongoCollection) Find ¶
func (c *MongoCollection) Find(query interface{}, opts ...*options.FindOptions) (handlers.Query, error)
Find shadows *mgo.Collection to returns a Query interface instead of *mgo.Query.
func (*MongoCollection) FindOne ¶
func (c *MongoCollection) FindOne(query interface{}, opts ...*options.FindOneOptions) handlers.Query
FindOne shadows *mgo.Collection to returns a Query interface instead of *mgo.Query.
type MongoConn ¶
type MongoConn struct {
// contains filtered or unexported fields
}
func (*MongoConn) DB ¶
DB shadows *mgo.DB to returns a Database interface instead of *mgo.Database.
func (*MongoConn) DatabaseNames ¶
type MongoDatabase ¶
MongoDatabase wraps a mgo.Database to embed methods in models.
func (*MongoDatabase) C ¶
func (d *MongoDatabase) C(name string) handlers.Collection
C shadows *mongo.DB to returns a Database interface instead of *mgo.Database.
func (*MongoDatabase) CollectionNames ¶
func (d *MongoDatabase) CollectionNames() (names []string, err error)
func (*MongoDatabase) Run ¶
func (d *MongoDatabase) Run(cmd, result interface{}) error
Run shadows *mgo.DB to returns a Database interface instead of *mgo.Database.
type MongoQuery ¶
type MongoQuery struct { *mongo.Cursor *mongo.SingleResult }
MongoQuery wraps a mgo.Query to embed methods in models.
func (*MongoQuery) Count ¶
func (q *MongoQuery) Count() (int, error)
func (*MongoQuery) Get ¶
func (q *MongoQuery) Get(result interface{}) error
func (*MongoQuery) GetSingle ¶
func (q *MongoQuery) GetSingle(result interface{}) error
type Plugin ¶
Plugin -
var Impl Plugin
func (*Plugin) Configure ¶
func (p *Plugin) Configure(global *plugin.GlobalOptions, options interface{})
Configure implements the Configurator interface. Initializes configuration structures.
func (*Plugin) Export ¶
func (*Plugin) Start ¶
func (p *Plugin) Start()
Start implements the Runner interface and performs initialization when plugin is activated.
type PluginOptions ¶
type PluginOptions struct { plugin.SystemOptions `conf:"optional,name=System"` // Timeout is the amount of time to wait for a server to respond when // first connecting and on follow up operations in the session. Timeout int `conf:"optional,range=1:30"` // KeepAlive is a time to wait before unused connections will be closed. KeepAlive int `conf:"optional,range=60:900,default=60"` // Sessions stores pre-defined named sets of connections settings. Sessions map[string]Session `conf:"optional"` // Default stores default connection parameter values from configuration file Default Session `conf:"optional"` }
type Session ¶
type Session struct { URI string `conf:"name=Uri,optional"` Password string `conf:"optional"` User string `conf:"optional"` TLSConnect string `conf:"name=TLSConnect,optional"` TLSCAFile string `conf:"name=TLSCAFile,optional"` TLSCertFile string `conf:"name=TLSCertFile,optional"` TLSKeyFile string `conf:"name=TLSKeyFile,optional"` }