Documentation ¶
Index ¶
- Constants
- type Backend
- type BitSet
- type BufferPoolManager
- func (bm *BufferPoolManager) InsertData(tablename string, pageid PageID, data [][]byte) (PageID, error)
- func (bm *BufferPoolManager) NewPool(tablename string, dir string)
- func (bm *BufferPoolManager) SelectDataRange(tablename string, start, end PageID) []*InternalPage
- func (bm *BufferPoolManager) UnpinPage(tablename string, frameid int)
- type Cell
- type Column
- type Condition
- type InsertColumn
- type InternalPage
- type Operator
- type PageID
- type Query
- type ResultColumn
- type Rows
- type Table
- type Type
Constants ¶
const ( COL_UNIQUE = iota + 1 COL_NOTNULL COL_NOTNULLUNIQUE COL_PRIMARY COL_ROWID )
const ( COL_I_PRIMARYNULL insertType = iota COL_I_PRIMARYVALUED COL_I_VALUED COL_I_NULL )
const ( PAGESIZE = 4096 MAXPOOLSIZE = 10 )
const ( INT = iota + 1 FLOAT BOOL CHAR )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func CreateNewDatabase ¶
func OpenExistingDatabase ¶
func (*Backend) CreateTable ¶
func (*Backend) GetTableParams ¶
type BitSet ¶
type BitSet struct {
// contains filtered or unexported fields
}
https://stackoverflow.com/questions/23192262/how-would-you-set-and-clear-a-single-bit-in-go TODO: Allocate one more bit for specifying row exists
func InitializeBitSet ¶
type BufferPoolManager ¶
type BufferPoolManager struct {
// contains filtered or unexported fields
}
func NewBufferPool ¶
func NewBufferPool(dir string) *BufferPoolManager
func (*BufferPoolManager) InsertData ¶
func (bm *BufferPoolManager) InsertData(tablename string, pageid PageID, data [][]byte) (PageID, error)
return last page modified
func (*BufferPoolManager) NewPool ¶
func (bm *BufferPoolManager) NewPool(tablename string, dir string)
func (*BufferPoolManager) SelectDataRange ¶
func (bm *BufferPoolManager) SelectDataRange(tablename string, start, end PageID) []*InternalPage
func (*BufferPoolManager) UnpinPage ¶
func (bm *BufferPoolManager) UnpinPage(tablename string, frameid int)
type Cell ¶
type Cell []byte
Contain functions to convert byte slice to appropriate datatype as supported by database
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
ColumnType values are define in parser.go
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 InternalPage ¶
type InternalPage struct {
// contains filtered or unexported fields
}
type Query ¶
type Query struct { Type Type 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) Aliases map[string]string TableConstruction [][]string //Used for CREATE }
Query represents a parsed query
type ResultColumn ¶
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
type Table ¶
TableName must be checked to be within 2 bytes range ColumnNames must have length within 1 byte range Columns slice must preserve order
func (*Table) GenerateFields ¶
func (t *Table) GenerateFields()
func (*Table) GenerateRowBytes ¶
type Type ¶
type Type int
Type is the type of SQL query, e.g. SELECT/UPDATE
const ( // UnknownType is the zero value for a Type UnknownType Type = 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 )