Documentation
¶
Index ¶
- func DSN(cfg config.PostgresConfig) string
- func IsUniqueViolation(err error) bool
- func Open(ctx context.Context, cfg config.PostgresConfig) (*pgxpool.Pool, error)
- func ParseUUID(id string) (pgtype.UUID, error)
- func RunMigrate(logger *slog.Logger, cfg config.PostgresConfig, migrationsFS fs.FS, ...) error
- func TextToString(value pgtype.Text) string
- func TimeFromPg(value pgtype.Timestamptz) time.Time
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 ¶
IsUniqueViolation reports whether err is a PostgreSQL unique constraint violation (SQLSTATE 23505).
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.