mongochk

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDialTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	Config  *MongoConfig
	Session *mgo.Session
}

func NewMongo

func NewMongo(cfg *MongoConfig) (*Mongo, error)

func (*Mongo) Status

func (m *Mongo) Status() (interface{}, error)

type MongoAuthConfig

type MongoAuthConfig struct {
	Url         string
	Credentials mgo.Credential
}

MongoAuthConfig, used to setup connection params for go-mongo check Url format is localhost:27017 or mongo://localhost:27017 Credential has format described at https://godoc.org/github.com/globalsign/mgo#Credential

type MongoConfig

type MongoConfig struct {
	Auth        *MongoAuthConfig
	Collection  string
	DB          string
	Ping        bool
	DialTimeout time.Duration
}

MongoConfig is used for configuring the go-mongo check.

"Auth" is _required_; redis connection/auth config.

"Collection" is optional; method checks if collection exist

"Ping" is optional; Ping runs a trivial ping command just to get in touch with the server.

"DialTimeout" is optional; default @ 10s; determines the max time we'll wait to reach a server.

Note: At least _one_ check method must be set/enabled; you can also enable _all_ of the check methods (ie. perform a ping, or check particular collection for existense).

Jump to

Keyboard shortcuts

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