Documentation
¶
Index ¶
- Constants
- func GetDbFile() string
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) ColumnIndexTypes(_ string, table string) (map[string]string, error)
- func (b *Backend) ColumnsMeta(_ string, table string) ([]db.ColumnMeta, error)
- func (b *Backend) FetchTable(_ string, table string, limit int) (*data.Frame, error)
- func (b *Backend) Kind() string
- func (b *Backend) Namespaces() ([]string, error)
- func (b *Backend) PrimaryKeys(_ string, table string) ([]string, error)
- func (b *Backend) Run(stmt string) (db.Result, error)
- func (b *Backend) Tables(string) ([]string, error)
- func (b *Backend) Title() string
- type Config
- type DB
- func (db *DB) Close() error
- func (db *DB) ColumnIndexTypes(table string) (map[string]string, error)
- func (db *DB) ColumnsMeta(table string) ([]dbapi.ColumnMeta, error)
- func (db *DB) FetchTableFields(table string) ([]string, error)
- func (db *DB) FetchTableRecords(table string) ([][]string, error)
- func (db *DB) ListPrimaryKeys(table string) ([]string, error)
- func (db *DB) ListTables() ([]string, error)
- func (db *DB) RawExec(query string) (sql.Result, error)
- func (db *DB) RawQuery(query string) (fields []string, records [][]string, err error)
- func (db *DB) RawSqlCommand(query string) (rawCmdResult RawCommandResult, err error)
- type RawCommandResult
Constants ¶
const ( // DQL SELECT = "select" PRAGMA = "pragma" WITH = "with" EXPLAIN = "explain" VALUES = "values" // max rows fetched when browsing a table from the tree view FetchLimit = 200 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend adapts the sqlite data-access layer to the db.Backend contract.
func Connect ¶
Connect opens the sqlite file and pings it before returning. The file must already exist.
func (*Backend) ColumnIndexTypes ¶
ColumnIndexTypes returns index type labels for indexed columns; namespace is ignored.
func (*Backend) ColumnsMeta ¶
ColumnsMeta returns column metadata for a table; the namespace argument is ignored.
func (*Backend) FetchTable ¶
FetchTable loads up to limit rows of a table; the namespace argument is ignored.
func (*Backend) Namespaces ¶
Namespaces returns a single empty namespace: sqlite files have no database/schema level.
func (*Backend) PrimaryKeys ¶
PrimaryKeys lists the primary-key column names of a table; the namespace argument is ignored.
func (*Backend) Run ¶
Run executes a statement, routing queries vs. mutations the same way the underlying data-access layer does. Query results come back as an all-string frame.
type Config ¶
type Config struct {
FilePath string
}
Config holds the connection parameters for a sqlite database file.
type DB ¶
var (
DbClinet *DB
)
func (*DB) ColumnIndexTypes ¶
ColumnIndexTypes returns a column→index-type map for table. Priority: PK > UNIQUE > INDEX. SQLite uses PRAGMA table_info for PKs and PRAGMA index_list + index_info for other indexes.
func (*DB) ColumnsMeta ¶
func (db *DB) ColumnsMeta(table string) ([]dbapi.ColumnMeta, error)
ColumnsMeta returns column metadata for table, in ordinal order. The namespace argument is ignored: sqlite files have no schema level. Column comments are not supported and stay empty.
func (*DB) FetchTableFields ¶
FetchTableFields returns the column names of a table via PRAGMA table_info.
func (*DB) ListPrimaryKeys ¶
ListPrimaryKeys lists the primary-key column names of table, in pk-ordinal order. Empty when the table has no primary key. The namespace argument is ignored: sqlite files have no schema level.
func (*DB) ListTables ¶
ListTables lists all user tables of the sqlite database file.
func (*DB) RawSqlCommand ¶
func (db *DB) RawSqlCommand(query string) (rawCmdResult RawCommandResult, err error)