Documentation
¶
Index ¶
- Constants
- Variables
- type BNode
- type BTree
- type DB
- func (db *DB) Close()
- func (db *DB) Delete(table string, rec Record) (bool, error)
- func (db *DB) Get(table string, rec *Record) (bool, error)
- func (db *DB) Insert(table string, rec Record) (bool, error)
- func (db *DB) Open() error
- func (db *DB) Set(table string, dbreq *DBUpdateReq) (bool, error)
- func (db *DB) TableNew(tdef *TableDef) error
- func (db *DB) Update(table string, rec Record) (bool, error)
- func (db *DB) Upsert(table string, rec Record) (bool, error)
- type DBUpdateReq
- type FreeList
- type KV
- type LNode
- type Record
- type TableDef
- type UpdateReq
- type Value
Constants ¶
View Source
const ( BNODE_NODE = 1 // internal nodes without values BNODE_LEAF = 2 // leaf nodes with values )
View Source
const ( MODE_UPSERT = 0 // insert or replace MODE_UPDATE_ONLY = 1 // update existing keys MODE_INSERT_ONLY = 2 // only add new keys )
update modes
View Source
const ( TYPE_ERROR = 0 TYPE_BYTES = 1 TYPE_INT64 = 2 )
View Source
const BTREE_MAX_KEY_SIZE = 1000
View Source
const BTREE_MAX_VAL_SIZE = 3000
View Source
const BTREE_PAGE_SIZE = 4096
View Source
const DB_SIG = "BuildYourOwnDB08"
View Source
const FREE_LIST_CAP = (BTREE_PAGE_SIZE - FREE_LIST_HEADER) / 8
View Source
const FREE_LIST_HEADER = 8
View Source
const HEADER = 4
View Source
const TABLE_PREFIX_MIN = 100
Variables ¶
View Source
var INTERNAL_TABLES map[string]*TableDef = map[string]*TableDef{ "@meta": TDEF_META, "@table": TDEF_TABLE, }
View Source
var TDEF_META = &TableDef{ Prefix: 1, Name: "@meta", Types: []uint32{TYPE_BYTES, TYPE_BYTES}, Cols: []string{"key", "val"}, PKeys: 1, }
internal table: metadata
View Source
var TDEF_TABLE = &TableDef{ Prefix: 2, Name: "@table", Types: []uint32{TYPE_BYTES, TYPE_BYTES}, Cols: []string{"name", "def"}, PKeys: 1, }
internal table: table schemas
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { Path string // contains filtered or unexported fields }
type DBUpdateReq ¶
type FreeList ¶
type FreeList struct {
// contains filtered or unexported fields
}
type KV ¶
type TableDef ¶
type TableDef struct { // user defined Name string Types []uint32 // column types Cols []string // column names PKeys int // the first `PKeys` columns are the primary key // auto-assigned B-tree key prefixes for different tables Prefix uint32 }
table schema
Click to show internal directories.
Click to hide internal directories.