dbutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dbutil provides shared helpers for database-layer operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTime

func FormatTime(t time.Time) string

FormatTime returns the RFC3339Nano UTC string for t. Used at write sites for TIMESTAMPTZ columns stored as TEXT.

func IsUniqueViolation

func IsUniqueViolation(err error) bool

IsUniqueViolation reports whether err is a SQLite unique constraint violation (extended result codes SQLITE_CONSTRAINT_UNIQUE / SQLITE_CONSTRAINT_PRIMARYKEY).

func MergeSettings

func MergeSettings(existing, newSettings json.RawMessage) json.RawMessage

MergeSettings returns newSettings with any keys absent from newSettings filled in from existing. Keys present in newSettings win, except the masked placeholder "***": API responses mask secrets that way, so a client that echoes a response back must not overwrite the real secret. This preserves secret fields (passwords, API keys) when the frontend omits them, or round-trips them masked, in an update request.

func NullStringValue

func NullStringValue(p *string) string

NullStringValue returns the dereferenced value of p, or "" if nil.

func NullableString

func NullableString(s string) *string

NullableString returns nil for an empty string, otherwise a pointer to s. Used to feed sqlc-generated *string params from string values where the convention is "empty means SQL NULL".

func ParseRFC3339

func ParseRFC3339(s string) time.Time

ParseRFC3339 parses an RFC3339(Nano) timestamp string, returning the zero time on any error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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