const ( JournalModeDelete = JournalMode("DELETE") JournalModeTruncate = JournalMode("TRUNCATE") JournalModePersist = JournalMode("PERSIST") JournalModeMemory = JournalMode("MEMORY") JournalModeWAL = JournalMode("WAL") JournalModeOff = JournalMode("OFF") )
Features implements tawesoft.co.uk/go/dev/sqlp features for SQLite3
var Features = sqlp.Features{ EscapeIdentifier: escapeIdentifier, EscapeString: escapeString, IsUniqueConstraintError: isUniqueConstraintError, }
Utf8Collation is a common Collation provided as a convenience
var Utf8Collation = Collation{"utf8", strings.Compare}
func Open(driverName string, dataSource string, config Config) (*sql.DB, error)
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 Opener(config Config) func(string, string) (*sql.DB, error)
Opener returns an Open function with the config argument already applied
func Register(driverName string, collations []Collation, extensions []interface{})
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.
A Collation is a names and a collation-aware string comparison function
type Collation struct { Name string Cmp func(string, string) int }
Config can be used to configure the SQLite connection
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 }
JournalMode is a type of SQLite journal mode
type JournalMode string