internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ORDER  = 128 //order*2=256 which is how many fit in a PAGESIZE block 4096/16(16 = 2 int64)
	MAXAMT = ORDER*2 + 1
)
View Source
const (
	COL_ISUNIQUE  = 1 << 0
	COL_ISNULL    = 1 << 1
	COL_ISPRIMARY = 1 << 2
)
View Source
const (
	COL_I_PRIMARYNULL insertType = iota
	COL_I_PRIMARYVALUED
	COL_I_VALUED
	COL_I_NULL
)
View Source
const (
	PAGESIZE    = 4096
	MAXPOOLSIZE = 10
	MAXINT64    = (1 << 63) - 1
)
View Source
const (
	INT = iota + 1
	FLOAT
	BOOL
	CHAR
)

Variables

This section is empty.

Functions

func InsertBranchKCNode

func InsertBranchKCNode(node node, key int64, left, right node)

func InsertKVLeafNode

func InsertKVLeafNode(node node, key int64, value int64)

func NewBufferPoolManager

func NewBufferPoolManager(dir string) *bufferPoolManager

Types

type Backend

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

func CreateNewDatabase

func CreateNewDatabase(dir string) *Backend

func OpenExistingDatabase

func OpenExistingDatabase(dir string) (*Backend, error)

func (*Backend) Close

func (b *Backend) Close()

func (*Backend) CreateTable

func (b *Backend) CreateTable(q Query) error

func (*Backend) Insert

func (b *Backend) Insert(q Query) error

func (*Backend) Select

func (b *Backend) Select(q Query) (driver.Rows, error)

type BitSet

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

func InitializeBitSet

func InitializeBitSet(n uint64) BitSet

func (*BitSet) Size

func (b *BitSet) Size() uint64

func (*BitSet) ToString

func (b *BitSet) ToString() string

type Cell

type Cell []byte

Contain functions to convert byte slice to appropriate datatype as supported by database

func (*Cell) AsBool

func (c *Cell) AsBool() bool

func (*Cell) AsFloat

func (c *Cell) AsFloat() float64

func (*Cell) AsInt

func (c *Cell) AsInt() int64

func (*Cell) AsString

func (c *Cell) AsString() string

type Column

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

ColumnType values are define in parser.go

Column values should always immutable after first creation TODO: change allocate buffer to not use columnoffset

type Condition

type Condition struct {
	// Operand1 is the left hand side operand
	Operand1 string
	// Operand1IsField determines if Operand1 is a literal or a field name
	Operand1IsField bool
	// Operator is e.g. "=", ">"
	Operator Operator
	// Operand1 is the right hand side operand
	Operand2 string
	// Operand2IsField determines if Operand2 is a literal or a field name
	Operand2IsField bool
}

Condition is a single boolean condition in a WHERE clause

type InsertColumn

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

type LRU

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

func InitialLRU

func InitialLRU() LRU

type Lexer

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

func NewLexer

func NewLexer(input string) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() token.Token

type Operator

type Operator int

Operator is between operands in a condition

const (
	// UnknownOperator is the zero value for an Operator
	UnknownOperator Operator = iota
	Eq                       // Eq -> "="
	Ne                       // Ne -> "!="
	Gt                       // Gt -> ">"
	Lt                       // Lt -> "<"
	Gte                      // Gte -> ">="
	Lte                      // Lte -> "<="
)

type PageID

type PageID int64

type Query

type Query struct {
	Type              QueryType
	TableName         string
	Conditions        []Condition
	Updates           map[string]string
	Inserts           [][]string
	Fields            []string // Used for SELECT (i.e. SELECTed field names) and INSERT (INSERTEDed field names) and CREATE
	Aliases           map[string]string
	TableConstruction createQuery
}

func Parse

func Parse(sql string) (Query, error)

Parse takes a string representing SQl query and parses it into a query.Query struct. May fail.

type QueryType

type QueryType int
const (
	// UnknownType is the zero value for a queryType
	UnknownType QueryType = iota
	// Select represents a SELECT query
	Select
	// Update represents an UPDATE query
	Update
	// Insert represents an INSERT query
	Insert
	// Delete represents a DELETE query
	Delete
	// Create represents a CREATE query
	Create
	//Drop represents a DROP query
	Drop
)

type ResultColumn

type ResultColumn struct {
	ColumnType uint8
	Name       string
	// contains filtered or unexported fields
}

type Rows

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

Result from sql select statement in driver query Must use pointer for interface to be properly implements and allow pointer to struct Implements driver.Rows

func (*Rows) Close

func (r *Rows) Close() error

func (*Rows) Columns

func (r *Rows) Columns() []string

func (*Rows) Next

func (r *Rows) Next(dest []driver.Value) error

type Table

type Table struct {
	Columns []Column
	Name    string //max size is maxuint8
	// contains filtered or unexported fields
}

TableName must be checked to be within 1 byte range ColumnNames must have length within 1 byte range Columns slice must preserve order

func (*Table) GenerateFields

func (t *Table) GenerateFields()

func (*Table) GenerateRowBytes

func (t *Table) GenerateRowBytes() uint64

func (*Table) String

func (t *Table) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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