Documentation ¶
Overview ¶
Package sqlite enchances a mattn/go-sqlite3 database with simple setup of things like utf8 collation and tawesoft.co.uk/go/sqlp features.
Package Information ¶
License: MIT (see LICENSE.txt)
Stable: candidate
For more information, documentation, source code, examples, support, links, etc. please see https://www.tawesoft.co.uk/go and https://www.tawesoft.co.uk/go/sqlp/sqlite3
Index ¶
Constants ¶
const ( JournalModeDelete = JournalMode("DELETE") JournalModeTruncate = JournalMode("TRUNCATE") JournalModePersist = JournalMode("PERSIST") JournalModeMemory = JournalMode("MEMORY") JournalModeWAL = JournalMode("WAL") JournalModeOff = JournalMode("OFF") )
Variables ¶
var Features = sqlp.Features{
EscapeIdentifier: escapeIdentifier,
EscapeString: escapeString,
IsUniqueConstraintError: isUniqueConstraintError,
}
Features implements tawesoft.co.uk/go/dev/sqlp features for SQLite3
var Utf8Collation = Collation{"utf8", strings.Compare}
Utf8Collation is a common Collation provided as a convenience
Functions ¶
func Open ¶
Open opens/creates an SQLite database with pragmas from config
DriverName should match the name used in Register (or leave blank for default)
DataSource is the sqlite connection string e.g. "file:/var/sqlite/example.sql" or ":memory:"
func Register ¶
Register creates a new Sqlite3 database driver named DriverName (e.g. "sqlite3_withCollations") that implements the given Collations and Extensions.
Currently extensions is a placeholder argument and is not implemented.
Must only be called once with a given driverName, otherwise Go will panic.
Types ¶
type Config ¶
type Config struct { // ForeignKeys enables/disables the SQLite foreign_keys pragma ForeignKeys bool // SecureDelete enables/disables the SQLite secure_delete pragma SecureDelete bool // JournalMode, defaults to JournalModeWAL JournalMode JournalMode }
Config can be used to configure the SQLite connection