db

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InTxDB

func InTxDB(conn *sql.DB, fn func(DBTX) error) error

InTxDB runs fn inside a transaction, passing a DBTX for use with repository/store functions. Commits on success, rolls back on error.

Types

type DB

type DB struct {
	Conn *sql.DB
}

func Open

func Open(path string) (*DB, error)

func (*DB) Close

func (d *DB) Close() error

type DBTX

type DBTX interface {
	Exec(query string, args ...any) (sql.Result, error)
	Query(query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
}

DBTX is satisfied by both *sql.DB and *sql.Tx, enabling the same query functions to be used in and out of transactions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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