sqlite

package
v3.0.0-...-a8f5813 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstWhere

func FirstWhere[T any](ctx context.Context, db *gorm.DB, notFound error, where string, args ...any) (*T, error)

FirstWhere fetches a single row of T matching the provided WHERE clause. It maps gorm.ErrRecordNotFound to notFound (when non-nil) and otherwise wraps the error with a generic "failed to query <T>" prefix.

Example:

user, err := sqlite.FirstWhere[user.User](ctx, s.db.DB, ErrUserNotFound, "username = ?", username)

func HasPragma

func HasPragma(query url.Values, name string) bool

HasPragma reports whether query sets the named _pragma.

func IsRetryableWriteError

func IsRetryableWriteError(err error) bool

IsRetryableWriteError reports whether a database write failed because the database was temporarily busy or timed out.

func NormalizeQuery

func NormalizeQuery(query url.Values) url.Values

NormalizeQuery converts mattn-style SQLite DSN options to _pragma values and drops every foreign_keys setting so callers control enforcement.

func RegisterFunctions

func RegisterFunctions() error

RegisterFunctions makes normalize(text, form) available to new SQLite connections.

Types

This section is empty.

Jump to

Keyboard shortcuts

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