dal

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2014 License: Apache-2.0 Imports: 5 Imported by: 0

README

dal

Data access layer abstraction for go incremental applications. Currently only supports mongo via mgo.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("ErrNotFound")

Functions

func IsObjectIdHex added in v0.2.0

func IsObjectIdHex(s string) bool

Types

type BSON

type BSON map[string]interface{}

type ChangeInfo added in v0.2.0

type ChangeInfo struct {
	Updated    int
	Removed    int
	UpsertedId interface{}
}

type Collection

type Collection interface {
	Find(BSON) Query
	EnsureIndex(Index) error
	FindId(interface{}) Query
	RemoveId(interface{}) error
	UpsertId(interface{}, interface{}) (*ChangeInfo, error)
}

type DAL

type DAL interface {
	Connect(string) (Session, error)
	IsObjectIdHex(string) bool
}

func NewDAL

func NewDAL() DAL

type Database

type Database interface {
	C(string) Collection
}

type Index added in v0.2.0

type Index struct {
	Key         []string
	Background  bool
	Sparse      bool
	ExpireAfter time.Duration
}

type Iter

type Iter interface {
	Next(interface{}) bool
}

type ObjectId

type ObjectId string

func NewObjectId added in v0.2.0

func NewObjectId() ObjectId

func ObjectIdHex added in v0.2.0

func ObjectIdHex(s string) ObjectId

func (ObjectId) GetBSON

func (id ObjectId) GetBSON() (interface{}, error)

func (ObjectId) Hex

func (id ObjectId) Hex() string

func (ObjectId) Valid

func (id ObjectId) Valid() bool

type Query

type Query interface {
	One(interface{}) error
	Sort(...string) Query
	Iter() Iter
}

type Session

type Session interface {
	Clone() Session
	Close()
	DB(s string) Database
}

Directories

Path Synopsis
Godeps
_workspace/src/labix.org/v2/mgo
Package mgo offers a rich MongoDB driver for Go.
Package mgo offers a rich MongoDB driver for Go.
_workspace/src/labix.org/v2/mgo/bson
Package bson is an implementation of the BSON specification for Go:
Package bson is an implementation of the BSON specification for Go:
_workspace/src/labix.org/v2/mgo/sasl
Package sasl is an implementation detail of the mgo package.
Package sasl is an implementation detail of the mgo package.
_workspace/src/labix.org/v2/mgo/txn
The txn package implements support for multi-document transactions.
The txn package implements support for multi-document transactions.

Jump to

Keyboard shortcuts

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