db

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DSN

func DSN(cfg config.PostgresConfig) string

DSN builds a PostgreSQL connection string from config.

func IsUniqueViolation

func IsUniqueViolation(err error) bool

IsUniqueViolation reports whether err is a PostgreSQL unique constraint violation (SQLSTATE 23505).

func Open

func ParseUUID

func ParseUUID(id string) (pgtype.UUID, error)

ParseUUID converts a string UUID to pgtype.UUID.

func RunMigrate

func RunMigrate(logger *slog.Logger, cfg config.PostgresConfig, migrationsFS fs.FS, command string, args []string) error

RunMigrate applies or rolls back database migrations. The migrationsFS should contain .sql files at its root (not in a subdirectory). Supported commands: "up", "down", "version", "force N".

func TextToString

func TextToString(value pgtype.Text) string

TextToString returns the string value of pgtype.Text, or "" when invalid.

func TimeFromPg

func TimeFromPg(value pgtype.Timestamptz) time.Time

TimeFromPg converts a pgtype.Timestamptz to time.Time.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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