odb

package
v0.0.0-...-cf82ea8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidIndexFind    = 1
	UnableToReadStorage = 2
	NoIndexProvided     = 4
	ObjectFromOtherDB   = 8
	InvalidType         = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryBuffer

type BinaryBuffer struct {
	io.Writer
	io.Reader
}

func (*BinaryBuffer) ReadInt32

func (bw *BinaryBuffer) ReadInt32() (int32, error)

func (*BinaryBuffer) ReadInt64

func (bw *BinaryBuffer) ReadInt64() (int64, error)

func (*BinaryBuffer) ReadString

func (bw *BinaryBuffer) ReadString() (string, error)

func (*BinaryBuffer) ReadTypedMap

func (bw *BinaryBuffer) ReadTypedMap(out *TypedMap) error

func (*BinaryBuffer) SwitchToReader

func (bw *BinaryBuffer) SwitchToReader(reader io.Reader)

func (*BinaryBuffer) SwitchToWriter

func (bw *BinaryBuffer) SwitchToWriter(writer io.Writer)

func (*BinaryBuffer) WriteInt32

func (bw *BinaryBuffer) WriteInt32(val int32) error

func (*BinaryBuffer) WriteInt64

func (bw *BinaryBuffer) WriteInt64(val int64) error

func (*BinaryBuffer) WriteString

func (bw *BinaryBuffer) WriteString(val string) (int, error)

func (*BinaryBuffer) WriteTypedMap

func (bw *BinaryBuffer) WriteTypedMap(obj *TypedMap) (int, error)

func (*BinaryBuffer) WriteValues

func (bw *BinaryBuffer) WriteValues(values ...interface{}) (int, error)

type DB

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

func NewDB

func NewDB(filename string, dbid int32) (*DB, error)

func (*DB) AddIndex

func (db *DB) AddIndex(idx Index)

func (*DB) FindByOID

func (db *DB) FindByOID(vals ...interface{}) (*Object, error)

func (*DB) FindOneByIndex

func (db *DB) FindOneByIndex(idxName string, vals ...interface{}) (*Object, error)

func (*DB) PutObject

func (db *DB) PutObject(o *Object) (*Object, error)

type DBEntry

type DBEntry struct {
	*Object
	// contains filtered or unexported fields
}

func (*DBEntry) InvalidateData

func (dbe *DBEntry) InvalidateData() []byte

func (*DBEntry) UpdateData

func (dbe *DBEntry) UpdateData() ([]byte, error)

type Error

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

func (Error) Code

func (e Error) Code() uint

func (Error) Error

func (e Error) Error() string

type Index

type Index interface {
	Name() string
	Find(values ...interface{}) (*DBEntry, error)
	Write(dbe *DBEntry) error
	ExplainError(err error, writingKey bool) error
}

type Object

type Object struct {
	TypedMap
}

func NewObject

func NewObject() *Object

func (*Object) DB

func (o *Object) DB() int32

func (*Object) LocalId

func (o *Object) LocalId() int64

func (*Object) Oid

func (o *Object) Oid() int64

func (*Object) SetDB

func (o *Object) SetDB(db int32)

func (*Object) SetLocalId

func (o *Object) SetLocalId(id int64)

func (*Object) SetVersion

func (o *Object) SetVersion(version int32)

func (*Object) Version

func (o *Object) Version() int32

type OidIndex

type OidIndex struct {
	*kv.DB
}

func (*OidIndex) ExplainError

func (o *OidIndex) ExplainError(err error, isKey bool) error

func (*OidIndex) Find

func (o *OidIndex) Find(values ...interface{}) (*DBEntry, error)

func (*OidIndex) Name

func (o *OidIndex) Name() string

func (*OidIndex) Write

func (o *OidIndex) Write(dbe *DBEntry) error

type TypedMap

type TypedMap map[string]interface{}

func (*TypedMap) Has

func (t *TypedMap) Has(name string) bool

func (*TypedMap) Int32

func (t *TypedMap) Int32(name string) int32

func (*TypedMap) Int64

func (t *TypedMap) Int64(name string) int64

func (*TypedMap) Put

func (t *TypedMap) Put(name string, val interface{}) bool

func (*TypedMap) String

func (t *TypedMap) String(name string) string

func (*TypedMap) UInt32

func (t *TypedMap) UInt32(name string) uint32

func (*TypedMap) Uint64

func (t *TypedMap) Uint64(name string) uint64

Jump to

Keyboard shortcuts

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