Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(pool Pool) error

func CloseRows

func CloseRows(rows Rows) error

func Count

func Count(pool Pool, query string, args ...any) (int64, error)

func Exec

func Exec(pool Pool, query string, args ...any) (int64, error)

func ExecCtx

func ExecCtx(h ctxpkg.Handle, pool Pool, query string, args ...any) (int64, error)

func Exists

func Exists(pool Pool, query string, args ...any) (bool, error)

func LastInsertId

func LastInsertId(pool Pool, query string, args ...any) (int64, error)

func Ping

func Ping(pool Pool) error

func RawDB

func RawDB(pool Pool) *sql.DB

func ScanAll

func ScanAll[T any](rows Rows) ([]T, error)

func ScanOne

func ScanOne[T any](rows Rows) (T, error)

func ScanRow

func ScanRow[T any](row Row) (T, error)

func Transaction

func Transaction(pool Pool, fn func(Tx) error) error

func TransactionWith

func TransactionWith(pool Pool, opts TxOptions, fn func(Tx) error) error

func TxExec

func TxExec(tx Tx, query string, args ...any) (int64, error)

Types

type IsolationLevel

type IsolationLevel string
const (
	IsolationLevelDefault         IsolationLevel = ""
	IsolationLevelReadUncommitted IsolationLevel = "read_uncommitted"
	IsolationLevelReadCommitted   IsolationLevel = "read_committed"
	IsolationLevelRepeatableRead  IsolationLevel = "repeatable_read"
	IsolationLevelSerializable    IsolationLevel = "serializable"
)

func AllIsolationLevel

func AllIsolationLevel() []IsolationLevel

func ParseIsolationLevel

func ParseIsolationLevel(s string) (IsolationLevel, error)

func (IsolationLevel) String

func (e IsolationLevel) String() string

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool(conn *sql.DB) Pool

func Open

func Open(driver string, connString string) (Pool, error)

type Row

type Row struct {
	// contains filtered or unexported fields
}

func QueryRow

func QueryRow(pool Pool, query string, args ...any) Row

func TxQueryRow

func TxQueryRow(tx Tx, query string, args ...any) Row

type Rows

type Rows struct {
	// contains filtered or unexported fields
}

func Query

func Query(pool Pool, query string, args ...any) (Rows, error)

func QueryCtx

func QueryCtx(h ctxpkg.Handle, pool Pool, query string, args ...any) (Rows, error)

func TxQuery

func TxQuery(tx Tx, query string, args ...any) (Rows, error)

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

type TxOptions

type TxOptions struct {
	IsolationLevel IsolationLevel
	ReadOnly       bool
}

Jump to

Keyboard shortcuts

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