mongo

package
v0.0.0-...-d7e0ad7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2014 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mongo provides an implementation of sorted.KeyValue using MongoDB.

Index

Constants

View Source
const (
	CollectionName = "keys" // MongoDB collection, equiv. to SQL table

)

We explicitely separate the key and the value in a document, instead of simply storing as key:value, to avoid problems such as "." being an illegal char in a key name. Also because there is no way to do partial matching for key names (one can only check for their existence with bson.M{$exists: true}).

Variables

This section is empty.

Functions

func NewKeyValue

func NewKeyValue(cfg Config) (sorted.KeyValue, error)

NewKeyValue returns a KeyValue implementation on top of MongoDB.

func Ping

func Ping(host string, timeout time.Duration) bool

Ping tests if MongoDB on host can be dialed.

Types

type Config

type Config struct {
	Server   string // Required. Defaults to "localhost" in ConfigFromJSON.
	Database string // Required.
	User     string // Optional, unless the server was configured with auth on.
	Password string // Optional, unless the server was configured with auth on.
}

Config holds the parameters used to connect to MongoDB.

func ConfigFromJSON

func ConfigFromJSON(cfg jsonconfig.Obj) (Config, error)

ConfigFromJSON populates Config from cfg, and validates cfg. It returns an error if cfg fails to validate.

Jump to

Keyboard shortcuts

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