moved the database-go project to this repository

This commit is contained in:
Timmelmann
2026-08-08 14:29:33 +02:00
commit ca2740a2e7
6 changed files with 196 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package models
import "encoding/binary"
const (
BNODE_NODE = 1
BNODE_LEAF = 2
)
func (node BNode) btype() uint16 {
return binary.LittleEndian.Uint16(node[0:2])
}
func (node BNode) nkeys() uint16 {
return binary.LittleEndian.Uint16(node[2:4])
}
func (node BNode) setHeader(btype uint16, nkeys uint16) {
binary.LittleEndian.PutUint16(node[0:2], btype)
binary.LittleEndian.PutUint16(node[2:4], nkeys)
}
func (node BNode) getPrt(ids uint16) uint64{
assert(ids < node.nkeys())
pos := HEADER + 8*ids
return binary.LittleEndian.Uint64(node[pos:])
}
func (node BNode) setPtr(idx uint16, val uint64) {
}