Documentation
¶
Overview ¶
Package name holds the name rules shared by definitions and routing keys across the repository: queue jobs, schedule entries, broadcast topics and app events.
Identifier checks a single name and Routable checks a dot-separated routing key, optionally with wildcards. Both return plain errors; callers wrap them with their own ErrInvalidName sentinel.
if err := name.Identifier("send-receipt"); err != nil {
return fmt.Errorf("invalid job name: %w", err)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Identifier ¶
Identifier validates s as a name of 1-64 bytes made of lowercase letters, digits, and hyphens that neither starts nor ends with a hyphen.
Example:
if err := name.Identifier("send-welcome-mail"); err != nil {
return fmt.Errorf("invalid job name: %w", err)
}
func Routable ¶
Routable validates s as a routing key: dot-separated tokens, each a valid Identifier, at most 255 bytes in total.
With pattern set, s is a receiver pattern: the token "*" may stand for any one token, and the token "#" may stand for the remaining tokens but only as the last token. Without pattern, wildcards are rejected.
Example:
if err := name.Routable("user.#", true); err != nil {
return fmt.Errorf("invalid subscription: %w", err)
}
Types ¶
This section is empty.