Documentation ¶
Index ¶
Constants ¶
View Source
const ( PragmaEncoding = "PRAGMA encoding;" PragmaEncodingStmt = "PRAGMA encoding = '%s';" UTF8 = "UTF-8" )
View Source
const ( PragmaForeignKeys = "PRAGMA foreign_keys;" PragmaForeignKeysStmt = "PRAGMA foreign_keys = ON;" )
View Source
const ( PragmaJournalMode = "PRAGMA journal_mode;" JournalModeDelete = "DELETE" JournalModeWAL = "WAL" )
View Source
const ( DbPrefix = "file:" DbName = "koans.db" BackupDbName = "koans-backup.db" DbFile = DbPrefix + DbName DbBackupFile = DbPrefix + BackupDbName DbFileShm = DbFile + "-shm" DbFileWal = DbFile + "-wal" SqliteCmd = "sqlite3" SqliteSchema = "main" SqliteConnErr = "failed to open db connection to %s" )
View Source
const ( PragmaTableList = "PRAGMA main.table_list;" UpsertRecordStmt = ` INSERT INTO %s(id, name) VALUES(?, ?) ON CONFLICT DO UPDATE SET updated=datetime('unixepoch');` )
View Source
const ( // STRICT must be appended to every CREATE TABLE // https://www.sqlite.org/stricttables.html // WITHOUT ROWID avoids null primary keys (CHECK needed for empty strings) // https://www.sqlite.org/withoutrowid.html TableTestWithoutRowIdStrict = "test_without_rowid_strict" CreateStrictWithoutRowIdTableStmt = `` /* 237-byte string literal not displayed */ )
View Source
const ( // STRICT must be appended to every CREATE TABLE // https://www.sqlite.org/stricttables.html TableTestStrict = "test_strict" CreateStrictTableStmt = `` /* 196-byte string literal not displayed */ )
View Source
const ( PragmaSynchronous = "PRAGMA synchronous;" PragmaSynchronousFull = "FULL" PragmaSynchronousNormal = "NORMAL" )
View Source
const ( PragmaTimeoutMs = 5000 PragmaTimeoutStmt = "PRAGMA busy_timeout = %d;" PragmaTimeout = "PRAGMA busy_timeout;" )
Variables ¶
View Source
var DbFiles []string = []string{ DbFile, DbFileShm, DbFileWal, DbBackupFile, }
Functions ¶
func BackupDbUrl ¶
BackupDBUrl - construct a Sqlite DSN (Data Source Name) string as a backup target https://www.sqlite.org/backup.html
func DbUrl ¶
DbUrl - construct a Sqlite DSN (Data Source Name) string https://github.com/mattn/go-sqlite3#connection-string
Types ¶
type Koans ¶
type Koans struct {
// contains filtered or unexported fields
}
func (*Koans) Backup ¶
Backup - backup WAL mode SQLite DB https://github.com/mattn/go-sqlite3/blob/master/_example/hook/hook.go
type TableListRaw ¶
type TableListRaw struct { // schema: the schema in which the table or view appears (for example "main" or "temp"). Schema string // name: the name of the table or view. Name string // type: the type of object - one of "table", "view", "shadow" (for shadow tables), or "virtual" for virtual tables. Type string // ncol: the number of columns in the table, including generated columns and hidden columns. NCol int // wr: 1 if the table is a WITHOUT ROWID table or 0 if is not. WR int // strict: 1 if the table is a STRICT table or 0 if it is not. Strict int }
func (*TableListRaw) Skip ¶
func (t *TableListRaw) Skip() bool
omit SQLite internal tables kv: schema.name -> skip == true
func (*TableListRaw) TableName ¶
func (t *TableListRaw) TableName() string
Click to show internal directories.
Click to hide internal directories.