textutil

package
v0.20.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StorageJSON added in v0.20.0

func StorageJSON(raw []byte) ([]byte, error)

StorageJSON normalizes string values before they reach jsonb. Decode only potentially unsafe input, preserving numeric precision and literal escapes.

func StorageText added in v0.20.0

func StorageText(text string) string

StorageText makes binary bytes visible in text-only transports. PostgreSQL text and jsonb cannot represent NUL, even when JSON encodes it as an escape. Existing literal backslash sequences are left untouched.

func TruncateRunes

func TruncateRunes(s string, maxRunes int) string

TruncateRunes returns s truncated to at most maxRunes Unicode code points.

func TruncateRunesWithSuffix

func TruncateRunesWithSuffix(s string, maxRunes int, suffix string) string

TruncateRunesWithSuffix returns s truncated to at most maxRunes Unicode code points, appending suffix when truncation occurs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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