pgnull

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package pgnull builds nullable pgx column values from plain Go values, collapsing the empty value to SQL NULL. It replaces the per-package `pgtype.Text{String: v, Valid: v != ""}` one-liners that accumulated across the codebase so every call site shares one NULL convention.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Text

func Text(s string) pgtype.Text

Text returns a pgtype.Text that is NULL when s is empty and the string otherwise. Use it for optional text columns where "" and NULL are the same absence (the common case: optional foreign keys, optional metadata).

func TextTrim

func TextTrim(s string) pgtype.Text

TextTrim is Text after trimming surrounding whitespace, so a value that is blank once trimmed also becomes NULL. Use it at ingestion boundaries where callers may pass whitespace-only strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

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