sqlite_modernc

package module
v0.0.0-...-4ddf07d Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package sqlite_modernc provides SQLite database connection and migration utilities using the modernc.org/sqlite driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URI             string
	Timeout         time.Duration
	MaxIdleConns    int
	MaxIdleTime     time.Duration
	MaxConnLifetime time.Duration
	AutoMigrate     bool
	MigrationsFS    fs.FS
	MigrationsPath  string
}

Config holds the configuration for the SQLite connection.

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection represents the database connection.

func NewConnection

func NewConnection(cfg Config) (*Connection, error)

NewConnection creates a new SQLite connection.

func (*Connection) Close

func (c *Connection) Close() error

Close closes the database connections.

func (*Connection) Config

func (c *Connection) Config() Config

Config returns a copy of the connection configuration.

func (*Connection) Ping

func (c *Connection) Ping(ctx context.Context) error

Ping checks the database connection.

func (*Connection) ReadDB

func (c *Connection) ReadDB() *sqlx.DB

ReadDB returns the read database connection.

func (*Connection) WriteDB

func (c *Connection) WriteDB() *sqlx.DB

WriteDB returns the write database connection.

Jump to

Keyboard shortcuts

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