Documentation ¶
Index ¶
- func Register(name string, fn NewEngineFunc)
- func UnmapReflectValue(record Record, value reflect.Value, schema *TableSchemaStructure) error
- type Engine
- type Iteration
- type NewEngineFunc
- type Record
- type TableSchemaColumn
- type TableSchemaColumnKind
- type TableSchemaRow
- type TableSchemaStructure
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(name string, fn NewEngineFunc)
func UnmapReflectValue ¶
func UnmapReflectValue(record Record, value reflect.Value, schema *TableSchemaStructure) error
Take a Record
Types ¶
type Engine ¶
type Engine interface { // Opens or creates a database at the resource path Open(resource string) error // Closes and releases the database resource Close() error // Lists tables Tables() (tables map[string]int32) // Make/Get a handle for a table. CreateTable(table string) int32 // Records the table schema for named table // Restructuring existing data SyncTable(table int32, schema *TableSchemaStructure) error Schema(table int32) *TableSchemaStructure NewTransaction() (Transaction, error) // Release transaction without committing Release(transaction Transaction) error // Persists the modified state in Transaction to the engine's storage. Commit(transaction Transaction) error // Transactionless insertion of records Insert(table int32, records []Record) error // Transactionless count, returning number of records matched Count(table int32, expr *query.Expression) (count uint64, err error) // Transactionless query, returning matched records Query(table int32, expr *query.Expression) (records []Record, err error) // Transactionless update, modifying all matched records to have contents of Record Update(table int32, expr *query.Expression, columns []int, values []any) (affected_rows uint64, err error) // Transactionless delete, returning number of affected rows Delete(table int32, expr *query.Expression) (uint64, error) // Transactionless iteration through entire table Iterate(table int32, iteration Iteration) (err error) }
type NewEngineFunc ¶
type NewEngineFunc func() Engine
type Record ¶
type Record []any
func MapReflectValue ¶
func MapReflectValue(value reflect.Value, schema *TableSchemaStructure) (record Record, err error)
Using reflection, maps a Go struct into a storage Record.
type TableSchemaColumn ¶
type TableSchemaColumn struct { Index bool `json:"index"` // Index may or may not speed up lookups. Exclusive bool `json:"exclusive"` // When used with Index, Exclusive means that there can only be one index per instance of this column's value AutoIncrement bool `json:"auto_increment"` // Means that the column is an integer that increases Name string `json:"name"` Tag uint32 `json:"tag"` Size int32 `json:"size"` Kind TableSchemaColumnKind `json:"kind"` Members []TableSchemaColumn `json:"members"` }
type TableSchemaColumnKind ¶
type TableSchemaColumnKind uint8
const ( TableSchemaColumnUint TableSchemaColumnKind = iota TableSchemaColumnInt TableSchemaColumnFloat TableSchemaColumnBool TableSchemaColumnString TableSchemaColumnBytes TableSchemaColumnStructure TableSchemaColumnArray TableSchemaColumnSlice TableSchemaColumnMap TableSchemaColumnTime )
func (TableSchemaColumnKind) MarshalJSON ¶
func (kind TableSchemaColumnKind) MarshalJSON() (b []byte, err error)
func (*TableSchemaColumnKind) UnmarshalJSON ¶
func (kind *TableSchemaColumnKind) UnmarshalJSON(b []byte) (err error)
type TableSchemaRow ¶
type TableSchemaRow []TableSchemaColumn
type TableSchemaStructure ¶
type TableSchemaStructure struct {
Columns []TableSchemaColumn `json:"columns"`
}
func SchematizeStructureType ¶
func SchematizeStructureType(structure_type reflect.Type) (*TableSchemaStructure, error)
type Transaction ¶
type Transaction interface { Count(table int32, expr *query.Expression) (count uint64, err error) Query(table int32, expr *query.Expression) (records []Record, err error) Insert(table int32, records []Record) error Update(table int32, expr *query.Expression, columns []int, values []any) (affected_rows uint64, err error) Delete(table int32, expr *query.Expression) (deleted uint64, err error) Iterate(table int32, iteration Iteration) (err error) }
Transaction represents the state of the Engine and all its tables as it was before NewTransaction was called. It also contains information representing isolated modifications to the engine's state.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
engine
|
|
leveldb_core
Package leveldb_core implements a storage.Engine using LevelDB
|
Package leveldb_core implements a storage.Engine using LevelDB |
Click to show internal directories.
Click to hide internal directories.