mongo

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModifyQuery added in v1.31.0

func ModifyQuery(query bson.M, queryModifiers ...QueryModifier) bson.M

func NotDeleted added in v1.31.0

func NotDeleted(query bson.M) bson.M

func SplitAddresses

func SplitAddresses(addresses string) []string

Types

type Config

type Config struct {
	Addresses        []string      `json:"addresses"`
	TLS              bool          `json:"tls"`
	Database         string        `json:"database"`
	CollectionPrefix string        `json:"collectionPrefix"`
	Username         *string       `json:"-"`
	Password         *string       `json:"-"`
	Timeout          time.Duration `json:"timeout"`
}

func NewConfig

func NewConfig() *Config

func (*Config) Load

func (c *Config) Load(configReporter config.Reporter) error

func (*Config) Validate

func (c *Config) Validate() error

type QueryModifier added in v1.31.0

type QueryModifier func(query bson.M) bson.M

type Session

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

func (*Session) C

func (s *Session) C() *mgo.Collection

func (*Session) Close

func (s *Session) Close() error

func (*Session) ConstructUpdate

func (s *Session) ConstructUpdate(set bson.M, unset bson.M, operators ...map[string]bson.M) bson.M

func (*Session) EnsureAllIndexes

func (s *Session) EnsureAllIndexes(indexes []mgo.Index) error

func (*Session) IsClosed

func (s *Session) IsClosed() bool

type Status

type Status struct {
	State       string
	BuildInfo   *mgo.BuildInfo
	LiveServers []string
	Mode        mgo.Mode
	Safe        *mgo.Safe
	Ping        string
}

type Store

type Store struct {
	Config  *Config
	Session *mgo.Session
}

func NewStore

func NewStore(config *Config, logger log.Logger) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) IsClosed

func (s *Store) IsClosed() bool

func (*Store) NewSession

func (s *Store) NewSession(collection string) *Session

func (*Store) Status

func (s *Store) Status() interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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