database

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package database provides a thread-safe connection pool manager for Turso LibSQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close closes the database connection pool. Should only be called during graceful shutdown.

func GetDB

func GetDB() (*sql.DB, error)

GetDB returns a singleton database connection pool. Connection is lazily initialized on first call with robust pool configuration.

func InitIndexes

func InitIndexes(ctx context.Context) error

InitIndexes ensures critical performance indexes exist on tables.

func Ping

func Ping(ctx context.Context) error

Ping verifies that the database connection is alive.

func ResetDBInstance

func ResetDBInstance()

ResetDBInstance resets the singleton state so GetDB can be initialized again.

func SetDB

func SetDB(db *sql.DB)

SetDB explicitly overrides the singleton DB instance (e.g. for testing or custom pool configuration).

Types

This section is empty.

Jump to

Keyboard shortcuts

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