dbinterface

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dbinterface provides database interfaces to avoid import cycles. This package has no dependencies and can be imported by both database implementations and models/stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Querier

type Querier interface {
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
}

Querier is the centralized interface for database operations. It is implemented by *sql.DB, *sql.Tx, and *database.DB. This allows stores and repositories to accept any of these types and enables transaction support without code duplication.

type TxBeginner

type TxBeginner interface {
	Querier
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

TxBeginner is an interface for types that can begin transactions. It is implemented by *sql.DB and *database.DB.

Jump to

Keyboard shortcuts

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