Documentation
¶
Overview ¶
Package slug derives DNS-1123-compatible identifiers from free-text display names, with deterministic collision suffixes.
Index ¶
Constants ¶
const MaxLen = 63
Variables ¶
This section is empty.
Functions ¶
func From ¶
From slugifies a free-text display name. Lowercases, replaces runs of non-[a-z0-9] with a single dash, trims leading/trailing dashes, truncates to MaxLen. Returns "" when the input has no usable characters; callers should treat empty as an error.
func FromPrefix ¶ added in v0.3.0
FromPrefix normalizes the literal prefix of a wildcard pattern. Unlike From it keeps the boundary dash when the raw prefix ends mid-separator ("claude-fable-5[" → "claude-fable-5-"), so prefix matching against From-normalized keys stays boundary-accurate ("claude-fable-5[*]" must not match "claude-fable-50-foo"). No MaxLen truncation — patterns are validated, not minted.
func FromSuffix ¶ added in v0.3.0
FromSuffix normalizes the literal suffix of a wildcard pattern: the mirror of FromPrefix — keeps a leading boundary dash (":acme" → "-acme"), trims trailing separators ("]" → "").
func Unique ¶
Unique returns base if exists(base) is false; otherwise base-2, base-3, … until exists returns false. Callers own the uniqueness scope (per-kind index).
func WithSuffix ¶
WithSuffix appends "-N" to base, ensuring the result fits in MaxLen by trimming base. N ≥ 2 (callers iterate from 2).
Types ¶
This section is empty.