db

package
v0.0.0-...-da8896c Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2015 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_NO_EXIST           = errors.New("Key doesn't exist")
	ERR_NO_PK              = errors.New("No field is marked as primary key")
	ERR_INVALID_PK         = errors.New("The field maked as pk is not a []byte or a string or is nil")
	ERR_MULTIPLE_PK        = errors.New("Either one field can be marked as primary key or the GetPrimaryKey function returns one")
	ERR_NO_POINTER         = errors.New("A pointer is required to unmarshal data into it")
	ERR_DATA_TYPE_MISMATCH = errors.New("Data stored and expected value in struct do not match")
)

Functions

func IsErrDuplicateKey

func IsErrDuplicateKey(err error) bool

func IsErrIndexExists

func IsErrIndexExists(err error) bool

Types

type ChanRecord

type ChanRecord struct {
	Record interface{}
	Error  error
}

type DB

type DB interface {
	LinkRecordToDB(RecordObject) RecordObject
	CreateNewRecord(RecordObject) error
	DeleteRecord(RecordObject) (bool, error)
	GetRecord([]byte, RecordObject) error
	TouchRecord(RecordObject) error
	ExistsRecord(r RecordObject) (bool, error)
	ReplaceRecord(r RecordObject) error
	ScanRecords(r RecordObject) chan ChanRecord
	RegisterIndexes(r RecordObject) error
	DeleteIndexes(r RecordObject) error
	Search(RecordObject, string, string) chan ChanRecord
}

func NewDB

func NewDB(namespace string, host string, port int) (DB, error)

func NewTestDB

func NewTestDB(host string, port int) (DB, error)

type Record

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

func (Record) GetCreatedAt

func (r Record) GetCreatedAt() time.Time

func (*Record) GetDB

func (r *Record) GetDB() DB

func (Record) GetExpiration

func (r Record) GetExpiration() int32

func (Record) GetGeneration

func (r Record) GetGeneration() int32

func (*Record) GetPrimaryKey

func (r *Record) GetPrimaryKey() []byte

func (Record) GetUpdatedAt

func (r Record) GetUpdatedAt() time.Time

func (*Record) SetExpiration

func (r *Record) SetExpiration(e int32)

func (Record) Stored

func (r Record) Stored() bool

type RecordObject

type RecordObject interface {
	Validate() error
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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