plugin

package
v0.0.0-...-649b07e Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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.

func NewConnManager

func NewConnManager(keepAlive, timeout, hkInterval time.Duration, logger log.Logger) *ConnManager

NewConnManager initializes connManager structure and runs Go Routine that watches for unused connections.

func (*ConnManager) GetConnection

func (c *ConnManager) GetConnection(uri uri.URI, params map[string]string) (*MongoConn, error)

GetConnection returns an existing connection or creates a new one.

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

func (conn *MongoConn) DB(name string) handlers.Database

DB shadows *mgo.DB to returns a Database interface instead of *mgo.Database.

func (*MongoConn) DatabaseNames

func (conn *MongoConn) DatabaseNames() (names []string, err error)

func (*MongoConn) GetMaxTimeMS

func (conn *MongoConn) GetMaxTimeMS() int64

func (*MongoConn) Ping

func (conn *MongoConn) Ping() error

type MongoDatabase

type MongoDatabase struct {
	// *mgo.Database
	*mongo.Database
}

MongoDatabase wraps a mgo.Database to embed methods in models.

func (*MongoDatabase) C

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

type Plugin struct {
	plugin.Base
	// contains filtered or unexported fields
}

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 (p *Plugin) Export(key string, rawParams []string, ctx plugin.ContextProvider) (result interface{}, err error)

func (*Plugin) Start

func (p *Plugin) Start()

Start implements the Runner interface and performs initialization when plugin is activated.

func (*Plugin) Stop

func (p *Plugin) Stop()

Stop implements the Runner interface and frees resources when plugin is deactivated.

func (*Plugin) Validate

func (p *Plugin) Validate(options interface{}) error

Validate implements the Configurator interface. Returns an error if validation of a plugin's configuration is failed.

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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