datastore

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection interface {
	Find(query interface{}) Query
	// Count() (n int, err error)
	// Insert(docs ...interface{}) error
	Remove(selector interface{}) error
	UpdateId(selector, update interface{}) error
	Upsert(selector, update interface{}) (*mgo.ChangeInfo, error)
}

Collection is an interface for accessing a MongoDB collection

type Config

type Config struct {
	URL      string
	Database string
}

Config configures the database connection

type Database

type Database interface {
	C(name string) Collection
}

Database is an interface for accessing a MongoDB database

type Query

type Query interface {
	All(result interface{}) error
	One(result interface{}) error
}

Query is an interface for querying a MongoDB collection

type Session

type Session interface {
	DB() (Database, func())
}

Session is an interface for a MongoDB session

func NewSession

func NewSession(conf Config) (Session, error)

NewSession initializes a MongoDB connection to the given host

Jump to

Keyboard shortcuts

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