db

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnPool

type ConnPool interface {
	io.Closer
	QueryExec
	Transacter
}

ConnPool represents a connection pool interface.

func NewConnPool added in v0.3.9

func NewConnPool(db *sql.DB, options *driver.SqlOptions) ConnPool

NewConnPool create ConnPool based on sql.DB

type ExecResult

type ExecResult interface {
	RowsAffected() (int64, error)
	LastInsertId() (int64, error)
}

ExecResult represents the result of a SQL execution.

type QueryExec

type QueryExec interface {
	Exec(ctx context.Context, sql string, args ...any) (ExecResult, error)
	Query(ctx context.Context, sql string, args ...any) (Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) Row
	SqlOptions() *driver.SqlOptions
}

QueryExec defines an interface for executing SQL commands and queries.

type Row

type Row interface {
	Scan(dest ...any) error
}

Row provides an abstraction for a single database query result row. Scan maps the row result into the provided destination variables.

type Rows

type Rows interface {
	Close()
	Rows() iter.Seq2[int, Scanner]
	Columns() ([]string, error)
	Err() error
}

Rows represents a result set obtained from a database query.

type Scanner

type Scanner interface {
	Scan(dest ...any) error
}

Scanner is an interface used to read database rows into destination variables. Scan assigns the column values of the current row to the provided destination variables.

type Transacter

type Transacter interface {
	Transact(ctx context.Context, handler func(ctx context.Context) error) error
}

Transacter defines an interface for handling transactional operations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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