db

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const SchemaApplyTimeout = 5 * time.Second

Variables

View Source
var ErrRowNotFound = errors.New("row not found")

ErrRowNotFound is returned when a query finds no matching row.

View Source
var ErrUnique = errors.New("unique constraint failed")

Failed unique constraint, conflict.

Functions

This section is empty.

Types

type Dialect added in v0.10.0

type Dialect string

Dialect identifies the underlying database engine.

const (
	SQLiteDialect   Dialect = "sqlite"
	PostgresDialect Dialect = "postgres"
)

type NullTimeScanner added in v1.0.0

type NullTimeScanner struct {
	T **time.Time
}

NullTimeScanner implements database/sql.Scanner for nullable time.Time values stored as RFC3339 strings. T must point to the *time.Time field on the destination struct; it is set to nil when the column value is NULL.

func (NullTimeScanner) Scan added in v1.0.0

func (n NullTimeScanner) Scan(value any) error

Scan implements database/sql.Scanner.

type Queryer added in v0.10.0

type Queryer interface {
	Query(ctx context.Context, stmt string, args ...any) (*sql.Rows, error)
}

Queryer is satisfied by both SQLClient and Transaction.

type SQLClient

type SQLClient interface {
	// Begin starts a new transaction.
	Begin(ctx context.Context) (Transaction, error)
	// Exec executes a standard query without returning any rows.
	Exec(ctx context.Context, stmt string, args ...any) (sql.Result, error)
	// Query executes a standard query, returning resulting rows.
	Query(ctx context.Context, stmt string, args ...any) (*sql.Rows, error)
	// Dialect returns the underlying database dialect.
	Dialect() Dialect
}

type TimeString added in v1.0.0

type TimeString struct {
	time.Time
}

TimeString implements database/sql.Scanner for time.Time values stored as RFC3339/RFC3339Nano strings (e.g. by the SQLite driver).

func (*TimeString) Scan added in v1.0.0

func (t *TimeString) Scan(value any) error

Scan implements database/sql.Scanner.

type Transaction added in v0.6.0

type Transaction interface {
	// Exec executes a standard query without returning any rows.
	Exec(ctx context.Context, stmt string, args ...any) (sql.Result, error)
	// Query executes a standard query, returning resulting rows.
	Query(ctx context.Context, stmt string, args ...any) (*sql.Rows, error)
	// Commit commits the transaction.
	Commit() error
	// Rollback rolls the transaction back.
	Rollback() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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