sqlite

package module
v0.0.0-...-6989987 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package sqlite provides a SQLite database connection factory with sensible defaults. It uses mattn/go-sqlite3 when CGO is enabled, or modernc.org/sqlite as a pure-Go fallback, selected automatically via build tags.

Index

Constants

View Source
const (
	ENGINE = "sqlite3"
)

Variables

This section is empty.

Functions

func NewDB

func NewDB(ctx context.Context, filepath string, opts ...func(*connectionOption)) (*sql.DB, error)

NewDB creates a new SQLite database connection with the specified options. Provide the filepath as a relative or absolute path to the database file, or use ":memory:" for an in-memory database. For example "test.db", "./my/relative/path/to/test.db", "/absolute/path/to/test.db", or ":memory:". For options, you can use the provided functions to set the connection parameters.

func WithConnMaxIdleTime

func WithConnMaxIdleTime(connMaxIdleTime int) func(*connectionOption)

func WithConnMaxLifetime

func WithConnMaxLifetime(connMaxLifetime int) func(*connectionOption)

func WithConnMaxOpen

func WithConnMaxOpen(connMaxOpen int) func(*connectionOption)

func WithJournalMode

func WithJournalMode(journalMode string) func(*connectionOption)

func WithMode

func WithMode(mode string) func(*connectionOption)

Types

This section is empty.

Jump to

Keyboard shortcuts

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