sqlu

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

README

SQLite Utils

SQLite utils for go, specifically for modernc / sqlite.

Utils provided:

  • URI Builder: Build a connection string for SQLite in a type-safe way.
  • Attach database connection hook: The URI builder can encode a parameter for adding additional databases to each connection. Running ATTACH DATABASE will only do it for that one connection. To have it available on all connections, use the hook.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ParamCachePrivate           Param  = "cache=private"
	ParamCacheShared            Param  = "cache=shared"
	ParamImmutable              Param  = "immutable=1"
	ParamModeMemory             Param  = "memory"
	ParamModeRO                 Param  = "ro"
	ParamModeRW                 Param  = "rw"
	ParamModeRWC                Param  = "rwc"
	ParamNoLock                 Param  = "nolock=1"
	ParamPowerSafeOverWriteOff  Param  = "psow=0"
	ParamPowerSafeOverWriteOn   Param  = "psow=1"
	PragmaAutoVacuumFull        Pragma = "auto_vacuum=FULL"
	PragmaAutoVacuumIncremental Pragma = "auto_vacuum=INCREMENTAL"
	PragmaAutoVacuumNone        Pragma = "auto_vacuum=NONE"
	PragmaJournalModeWAL        Pragma = "journal_mode=wal"
	PragmaSynchronousNormal     Pragma = "synchronous=normal"
)
View Source
var (
	ErrAttachDatabaseNameMissing = errors.New("name missing")
)

Functions

func AttachConnectionHook

func AttachConnectionHook(conn sqlite.ExecQuerierContext, dsn string) error

Types

type AttachParams

type AttachParams struct {
	Filename string
	Database string
	Mode     Param
	Pragma   []Pragma
}

func (AttachParams) ConnectionString

func (p AttachParams) ConnectionString() string

type ConnParams

type ConnParams struct {
	Filename string
	Mode     Param
	Pragma   []Pragma
	Attach   []AttachParams
}

func (ConnParams) ConnectionString

func (p ConnParams) ConnectionString() string

type Param

type Param string

func ParamModeOfFile

func ParamModeOfFile(filename string) Param

type Pragma

type Pragma string

func PragmaBusyTimeout

func PragmaBusyTimeout(t int64) Pragma

func PragmaJournalSizeLimit

func PragmaJournalSizeLimit(n int64) Pragma

PragmaJournalSizeLimit Sets the maximum size of the journal in BYTES. Must be set on every attached database separately.

https://www.sqlite.org/pragma.html#pragma_journal_size_limit

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL