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 ¶
FormatTime returns the RFC3339Nano UTC string for t. Used at write sites for TIMESTAMPTZ columns stored as TEXT.
func IsUniqueViolation ¶
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 ¶
NullStringValue returns the dereferenced value of p, or "" if nil.
func NullableString ¶
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 ¶
ParseRFC3339 parses an RFC3339(Nano) timestamp string, returning the zero time on any error.
Types ¶
This section is empty.