Documentation ¶
Index ¶
Constants ¶
View Source
const ( DatabaseObject = HeaderType('D') SchemaObject = HeaderType('S') DocumentObject = HeaderType('O') IndexObject = HeaderType('I') )
View Source
const ( PrimaryIndex = IndexType(1) SecondaryIndex = IndexType(2) )
View Source
const (
CBOR = DocumentType(1)
)
View Source
const (
V1 = Version(1)
)
Variables ¶
View Source
var DatabaseKeyHeader = [2]byte{byte(DatabaseObject), byte(byte(CBOR) | headerByteFromVersion(V1))}
View Source
var DocumentKeyHeader = [2]byte{byte(DocumentObject), byte(byte(CBOR) | headerByteFromVersion(V1))}
View Source
var (
ErrNotExist = errors.New("not exist")
)
View Source
var PrimaryIndexHeader = [2]byte{byte(IndexObject), byte(byte(PrimaryIndex) | headerByteFromVersion(V1))}
View Source
var SchemaKeyHeader = [2]byte{byte(SchemaObject), byte(byte(CBOR) | headerByteFromVersion(V1))}
View Source
var SecondaryIndexHeader = [2]byte{byte(IndexObject), byte(byte(SecondaryIndex) | headerByteFromVersion(V1))}
Functions ¶
func NewObjectNotExistError ¶
Types ¶
type Database ¶
type Database interface { // Name returns the unique name. Name() string // Transact begin a new transaction. Transact(write bool) (Transaction, error) }
Database represents a database interface.
type DocumentType ¶
type DocumentType byte
type HeaderType ¶
type HeaderType byte
type Key ¶
Key represents an object key.
func NewKeyWith ¶
NewKeyWith returns a new key from the specified header and key elements.
type KeyHeader ¶
type KeyHeader [2]byte
KeyHeader represents a header for any keys.
func (KeyHeader) DocumentType ¶
func (header KeyHeader) DocumentType() DocumentType
func (KeyHeader) Type ¶
func (header KeyHeader) Type() HeaderType
type ResultSet ¶
type ResultSet interface { // Next moves the cursor forward next object from its current position. Next() bool // Object returns an object in the current position. Object() *Object }
ResultSet represents a result set which includes query execution results.
type Store ¶
type Store interface { // CreateDatabase creates a new database. CreateDatabase(name string) error // GetDatabase retruns the specified database. GetDatabase(name string) (Database, error) // RemoveDatabase removes the specified database. RemoveDatabase(name string) error }
Store represents a store interface.
type Transaction ¶
type Transaction interface { // Set stores a key-value object. If the key already holds some value, it is overwritten. Set(obj *Object) error // Get returns a key-value object of the specified key. Get(key Key) (*Object, error) // GetRange returns a result set of the specified key. GetRange(key Key) (ResultSet, error) // Remove removes the specified key-value object. Remove(key Key) error // Commit commits this transaction. Commit() error // Cancel cancels this transaction. Cancel() error }
Transaction represents a transaction interface.
Click to show internal directories.
Click to hide internal directories.