Documentation
¶
Overview ¶
Package sql provides the public API for the GSQL database.
Index ¶
- func ExecSQL(db *DB, sql string) (string, error)
- func Version() string
- type Column
- type Config
- type DB
- func (db *DB) Begin() error
- func (db *DB) Close() error
- func (db *DB) Commit() error
- func (db *DB) CreateIndex(name, table string, cols []string, unique bool) error
- func (db *DB) CreateTable(name string, cols []*Column) error
- func (db *DB) DropIndex(name string) error
- func (db *DB) DropTable(name string) error
- func (db *DB) Exec(sql string) (int64, error)
- func (db *DB) Flush() error
- func (db *DB) GetBTree() interface{}
- func (db *DB) GetIndex(name string) *schema.Index
- func (db *DB) GetSchema() *schema.Schema
- func (db *DB) GetTable(name string) *schema.Table
- func (db *DB) GetTableData(name string) interface{}
- func (db *DB) Prepare(sql string) (*Stmt, error)
- func (db *DB) Query(sql string) (*Stmt, error)
- func (db *DB) Rollback() error
- func (db *DB) SetTableData(name string, data interface{})
- func (db *DB) Table(name string) interface{}
- type Stmt
- type TableData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB struct {
VFS *vfs.VFS
File vfs.File
Pager *pager.Pager
BTree *btree.Btree
Schema *schema.Schema
InTrans bool
LastID int64
Changes int64
IsMemory bool
Tables map[string]interface{} // In-memory table storage (schema cache)
// Savepoint tracking
SavepointName string
}
DB represents a database connection.
func Open ¶
Open opens a database file. If filename is ":memory:" or starts with "mem", an in-memory database is used. Otherwise, a persistent database file is created/opened.
func (*DB) CreateIndex ¶
CreateIndex is no-op for compatibility (use Exec with CREATE INDEX SQL).
func (*DB) CreateTable ¶
CreateTable is no-op for compatibility (use Exec with CREATE TABLE SQL).
func (*DB) GetBTree ¶
func (db *DB) GetBTree() interface{}
GetBTree implements codegen.DB interface.
func (*DB) GetTableData ¶
GetTableData gets table data by name (implements vdbe.DB interface).
func (*DB) SetTableData ¶
SetTableData sets table data by name (implements vdbe.DB interface).
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt represents a prepared statement.
func (*Stmt) ColumnCount ¶
ColumnCount returns the number of columns in the result.
type TableData ¶
type TableData struct {
Rows [][]interface{}
NextRowID int64
ColNames []string // Column names for the table
}
TableData holds in-memory table data
func (*TableData) AddRow ¶
func (t *TableData) AddRow(row []interface{})
AddRow adds a row to the table
func (*TableData) GetNextRowID ¶
GetNextRowID returns the next row ID
func (*TableData) GetRows ¶
func (t *TableData) GetRows() [][]interface{}
GetRows returns the rows in this table
func (*TableData) SetNextRowID ¶
SetNextRowID sets the next row ID
Directories
¶
| Path | Synopsis |
|---|---|
|
Package btree implements the SQLite B-Tree storage engine.
|
Package btree implements the SQLite B-Tree storage engine. |
|
Package codegen generates VDBE bytecode from AST.
|
Package codegen generates VDBE bytecode from AST. |
|
Package expr provides expression evaluation for SQL.
|
Package expr provides expression evaluation for SQL. |
|
Package func provides built-in SQL functions.
|
Package func provides built-in SQL functions. |
|
Package pager implements the SQLite Pager layer for page management.
|
Package pager implements the SQLite Pager layer for page management. |
|
Package parser provides SQL parsing and AST definitions.
|
Package parser provides SQL parsing and AST definitions. |
|
Package schema provides the database schema and catalog management.
|
Package schema provides the database schema and catalog management. |
|
Package tokenize provides SQL tokenization.
|
Package tokenize provides SQL tokenization. |
|
Package transaction provides transaction and savepoint management.
|
Package transaction provides transaction and savepoint management. |
|
Package vdbe provides the Virtual Database Engine for executing SQL.
|
Package vdbe provides the Virtual Database Engine for executing SQL. |
|
Package vfs provides SQLite-compatible VFS (Virtual File System) implementations.
|
Package vfs provides SQLite-compatible VFS (Virtual File System) implementations. |
|
Package wal implements the SQLite Write-Ahead Log (WAL).
|
Package wal implements the SQLite Write-Ahead Log (WAL). |