mongo

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config map[string]interface{}) (interface{}, error)

Mongo Client component, configuration: components:

mongo:
    dsn: "mongodb://host1:port1/[db][?options]"
    connectTimeout: "1s"
    readTimeout: "10s"
    writeTimeout: "10s"

see Dial() for query options, default: replicaSet= connect=replicaSet maxPoolSize=100 minPoolSize=1 maxIdleTimeMS=300000 ssl=false w=1 j=false wtimeoutMS=10000 readPreference=secondaryPreferred

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) GetSession

func (c *Client) GetSession() *mgo.Session

func (*Client) Init

func (c *Client) Init() error

func (*Client) SetConnectTimeout

func (c *Client) SetConnectTimeout(v string) error

func (*Client) SetDsn

func (c *Client) SetDsn(dsn string)

func (*Client) SetReadTimeout

func (c *Client) SetReadTimeout(v string) error

func (*Client) SetWriteTimeout

func (c *Client) SetWriteTimeout(v string) error

Jump to

Keyboard shortcuts

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