db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQLite   = "sqlite"
	Postgres = "postgres"
	MySQL    = "mysql"
)

Driver types supported by the framework.

Variables

This section is empty.

Functions

func GetTx

func GetTx(ctx context.Context) *sql.Tx

GetTx retrieves a transaction from a context, if present.

func WithTx

func WithTx(ctx context.Context, tx *sql.Tx) context.Context

WithTx attaches a transaction to a context.

Types

type Backend

type Backend struct {
	*sql.DB
	Driver string
	DSN    string
}

Backend handles the shared database connection and pool settings.

func NewBackend

func NewBackend(driver, dsn string) (*Backend, error)

NewBackend creates and initializes a new database backend based on the config.

func NewBackendFromDB

func NewBackendFromDB(db *sql.DB, driver string) (*Backend, error)

NewBackendFromDB wraps an existing *sql.DB connection into a Mana Backend.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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