db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TracedDriverName = "sqlite3-traced"

Variables

This section is empty.

Functions

func BoolToInt

func BoolToInt(b bool) int64

func FloatOrZero

func FloatOrZero(v sql.NullFloat64) float64

FloatOrZero returns the float64 value of a sql.NullFloat64 or zero if it's null.

func Int64OrZero

func Int64OrZero(v sql.NullInt64) int64

Int64OrZero returns the int64 value of a sql.NullInt64 or zero if it's null.

func IsUniqueViolation

func IsUniqueViolation(err error) bool

IsUniqueViolation returns true if the error is a SQLite UNIQUE constraint violation.

func Migrate

func Migrate(ctx context.Context, db *sql.DB, dir fs.FS) error

func NullJoined

func NullJoined(xs []string) sql.NullString

NullJoined returns a NullString by joining xs with commas. Returns an invalid NullString if xs is empty.

func NullableFloat

func NullableFloat(v float64) sql.NullFloat64

func RegisterTracedDriver

func RegisterTracedDriver(tr *Tracer)

Types

type Tracer

type Tracer struct {
	SlowThresh  time.Duration // 0 = off
	MaskArgs    bool
	SampleEvery int // 0/1 => all; N => 1/N
}

Jump to

Keyboard shortcuts

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