Documentation ¶
Index ¶
- Constants
- Variables
- func UUIDBinToStr(uid [16]byte) string
- func UUIDNewV4() (string, error)
- func UUIDStrToBin(txt string) (uid [16]byte, err error)
- type Column
- type ColumnType
- type Constraint
- type Database
- type FuryConn
- type FuryDriver
- type InsertStatement
- type NullBytes
- type NullUUID
- type OperatorType
- type Parser
- type RawBytes
- type Row
- type Scanner
- type SelectStatement
- type Table
- type TableCreateResult
- type TableCreateStatement
- type Token
- type Where
Constants ¶
const ( VersionMajor int = 0 // database schema change VersionMinor int = 1 // bug fixes // verbose level, use to aid debug // 0 off // 1 minimal, lib/info level // 2 func level // 3 block level // 4 loop level Verbose int = 1 )
version of furydb
const ( OperatorTypeLessThan int = iota OperatorTypeLessThanOrEqual OperatorTypeMoreThan OperatorTypeMoreThanOrEqual OperatorTypeEqual OperatorTypeNotEqual )
types of comparisions
Variables ¶
var ( ErrTableNotExist = fmt.Errorf("no such table") ErrColumnNotExist = fmt.Errorf("no such column") ErrFieldValueLengthNotMatch = fmt.Errorf("columns and values length not match") ErrValueTypeNotBool = fmt.Errorf("value type not bool") ErrValueTypeNotInt = fmt.Errorf("value type not int") ErrValueTypeNotFloat = fmt.Errorf("value type not float") ErrValueTypeNotString = fmt.Errorf("value type not string") ErrValueTypeNotTime = fmt.Errorf("value type not time") ErrValueTypeNotBytes = fmt.Errorf("value type not bytes") ErrValueTypeNotUUID = fmt.Errorf("value type not uuid") ErrValueTypeNotMatch = fmt.Errorf("value type type not match") ErrColumnNotNullable = fmt.Errorf("column not nullable") ErrUnknownColumnType = fmt.Errorf("unknown column type") ErrInvalidUUID = fmt.Errorf("invalid uuid") ErrDataTooBig = fmt.Errorf("data row too big") )
various errors
Functions ¶
func UUIDBinToStr ¶
UUIDBinToStr convert uuid binary to string
func UUIDStrToBin ¶
UUIDStrToBin convert uuid string to bytes
Types ¶
type Column ¶
type Column struct { Name string // name of the column Type ColumnType // column data type // anything below is used for holding data DataIsNull bool // value is null (if column is nullable) DataIsValid bool // value is valid (if column is nullable) DataBool bool // value in type bool DataInt int64 // value in type int DataFloat float64 // value in type float64 DataString string // value in type string DataTime time.Time // value in type time.Time DataBytes []byte // value in type []byte DataUUID [16]byte // value in type uuid }
Column holds schema of individual column, also can be use to hold data
type ColumnType ¶
type ColumnType int
ColumnType that dictate data type that the column value holds
const ( ColumnTypeBool ColumnType = 1 ColumnTypeInt ColumnType = 2 ColumnTypeFloat ColumnType = 3 ColumnTypeString ColumnType = 4 ColumnTypeTime ColumnType = 5 ColumnTypeBytes ColumnType = 6 ColumnTypeUUID ColumnType = 7 )
various column types
type Constraint ¶
type Constraint struct { Name string // name of constraint ColumnName string // column name for Type ColumnType // what is the type of column IsPrimaryKey bool // is column primary key IsUnique bool // is column unique IsNotNull bool // is column not null IsForeignKey bool // is this a foreign key? ForeignTable string // foreign key table ForeignColumn string // foreign key column UseDefaultData bool // does it have default value DefaultDataBool bool // default value in type bool DefaultDataInt int64 // default value in type int64 DefaultDataFloat float64 // default value in type float64 DefaultDataString string // default value in type string DefaultDataTime string // default value to use, e.g. now() DefaultDataBytes []byte // default value in type []byte DefaultDataUUID string // default value in use, e.g. gen_uuid_v4() }
Constraint holds table column constraint
type Database ¶
type Database struct { Name string // is just a placeholder Folderpath string Tables []*Table VersionMajor int VersionMinor int }
Database holds schema of entire database in self contained unit
type FuryConn ¶
type FuryConn struct {
// contains filtered or unexported fields
}
FuryConn sql connection
type InsertStatement ¶
type InsertStatement struct { FieldsAll bool // true if using all field(s) Fields []string // or individual field(s) Values []string TableName string }
InsertStatement represents a SQL INSERT statement.
type NullBytes ¶
NullBytes for nullable bytes
type NullUUID ¶
NullUUID for nullable uuid
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a parser.
type RawBytes ¶
type RawBytes []byte
RawBytes is a byte slice that holds a reference to memory owned by the database itself. After a Scan into a RawBytes, the slice is only valid until the next call to Next, Scan, or Close.
type Row ¶
type Row struct { TableName string // name of the table row refers to Columns []*Column // holds column data Deleted bool // if deleted, will be skipped during scan }
Row holds a single row of table data
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner represents a lexical scanner.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
type SelectStatement ¶
type SelectStatement struct { FieldsAll bool // true if using all field(s) Fields []string // or individual field(s) TableName string }
SelectStatement represents a SQL SELECT statement.
type Table ¶
type Table struct { Name string Columns []*Column Constraints []*Constraint }
Table holds schema of individual table
type TableCreateResult ¶
type TableCreateResult struct { }
type TableCreateStatement ¶
type TableCreateStatement struct { Columns []string // of individual column Types []string // of individual column type TableName string }
TableCreateStatement represents a SQL CREATE TABLE statement.
type Token ¶
type Token int
Token represents a lexical token.
const ( // Special tokens ILLEGAL Token = iota EOF WS // Literals IDENT // main VALUE // sql value; 'bla', 1, 1.23 // Misc characters ASTERISK // * COMMA // , LEFTPAR // ( RIGHTPAR // ) SINGLEQUO // ' DOUBLEQUO // " SEMICOL // ; // Keywords // sql create table CREATE TABLE // sql insert INSERT INTO VALUES // sql select SELECT FROM // Column Types BOOL INT FLOAT STRING TIME BYTES UUID // Constraints NOTNULL PRIMARYKEY FOREIGNKEY )
type Where ¶
type Where struct { OperatorType OperatorType Value interface{} }
Where condisions to match