Documentation
¶
Index ¶
Constants ¶
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)
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).