backend

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBackendNotInitializedError = errors.New("backend not initialized")
	ErrBackendType                = errors.New("object type is incorrect")
)

Functions

func Each added in v0.3.4

func Each(i Iterator, fn func(interface{}) error) error

func EachChannel added in v0.3.4

func EachChannel(i Iterator) chan interface{}

func NewBackendContext added in v0.3.4

func NewBackendContext(ctx context.Context, b Backend) context.Context

Types

type Backend

type Backend interface {
	Find(objectType string, query map[string]interface{}) (Iterator, error)
	FindID(objectType string, id interface{}) (interface{}, error)
	Upsert(objectType string, query map[string]interface{}, object interface{}) error
	UpsertID(objectType string, id, object interface{}) error
	Close() error
}

func BackendFromContext added in v0.3.4

func BackendFromContext(ctx context.Context) (Backend, error)

type IdentityMap added in v0.3.4

type IdentityMap struct {
	Backend
	// contains filtered or unexported fields
}

func NewIdentityMap added in v0.3.4

func NewIdentityMap(b Backend) *IdentityMap

func (*IdentityMap) FindID added in v0.3.4

func (m *IdentityMap) FindID(objectType string, id interface{}) (interface{}, error)

type Iterator added in v0.3.4

type Iterator interface {
	Next() (value interface{}, done bool, err error)
}

type MongoDBBackend added in v0.3.4

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

MongoDBBackend represents a MongoDB backend.

func NewMongoDBBackend added in v0.3.4

func NewMongoDBBackend(addrs []string, database, username, password string, ssl bool) (*MongoDBBackend, error)

NewMongoDBBackend creates a new MongoDBBackendBackend object using a MongoDB conection string. Any database defined in the connection string will be overridden by the argument-specified database.

func (*MongoDBBackend) Close added in v0.3.4

func (m *MongoDBBackend) Close() error

Close closes the underlying session.

func (*MongoDBBackend) Find added in v0.3.4

func (m *MongoDBBackend) Find(objectType string, query map[string]interface{}) (Iterator, error)

func (*MongoDBBackend) FindID added in v0.3.4

func (m *MongoDBBackend) FindID(objectType string, id interface{}) (interface{}, error)

func (*MongoDBBackend) Upsert added in v0.3.4

func (m *MongoDBBackend) Upsert(objectType string, query map[string]interface{}, object interface{}) error

func (*MongoDBBackend) UpsertID added in v0.3.4

func (m *MongoDBBackend) UpsertID(objectType string, id, object interface{}) error

Jump to

Keyboard shortcuts

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