sqlite

package
v0.0.2-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string)

Register registers the enhanced SQLite driver with the sql package using the specified name. This allows the driver to be used with sql.Open() calls. The driver automatically enables foreign key constraints for all connections.

Types

type Driver

type Driver struct {
	sqlite.Driver
}

Driver wraps the modernc.org/sqlite.Driver to provide additional functionality. It automatically enables foreign key constraints on connection establishment.

func NewDriver

func NewDriver() *Driver

NewDriver creates a new SQLite driver instance with enhanced functionality. The returned driver automatically enables foreign key constraints for all connections.

func (Driver) Open

func (d Driver) Open(name string) (driver.Conn, error)

Open establishes a connection to the SQLite database and enables foreign key constraints. It wraps the underlying driver's Open method and executes "PRAGMA foreign_keys = on;" to ensure referential integrity is enforced. Returns an error if connection fails.

Jump to

Keyboard shortcuts

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