database

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFTS5Support

func CheckFTS5Support(db *bun.DB) error

CheckFTS5Support verifies FTS5 is available in the SQLite build. This should be called after database initialization to ensure search functionality will work.

func IsUniqueViolation added in v0.1.0

func IsUniqueViolation(err error) bool

IsUniqueViolation reports whether err came from a SQLite UNIQUE constraint.

func New

func New(cfg *config.Config) (*bun.DB, error)

func RetrieveOnUniqueViolation added in v0.1.0

func RetrieveOnUniqueViolation[T any](created T, createErr error, retrieve func() (T, error)) (T, error)

RetrieveOnUniqueViolation finishes a find-or-create. When the insert failed on a UNIQUE constraint because another request inserted the same row between the lookup and the insert, it returns what retrieve finds instead. Otherwise it returns created, or createErr when the insert failed for another reason.

Types

This section is empty.

Jump to

Keyboard shortcuts

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