keyenc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package keyenc is the one escaping composite WaveHouse keys are built from: NATS subject tokens, cache keys and dedupe keys. A field keeps ASCII letters, digits, '_' and '-' as they are and writes every other byte as %XX (uppercase hex), so no separator, wildcard, whitespace, brace or non-ASCII byte ever appears in it unescaped, and any table name ClickHouse accepts encodes. The bytes it keeps are exactly a tenant id's (tenant.Parse), so a tenant id is its own escaped form.

Keys built from it are stored — queued under NATS subjects, held in caches, kept as dedupe keys — so a change to what it keeps orphans them; an orphaned dedupe key lets a seen id through again. Earlier builds escaped '-' as %2D; Unescape still reads that form.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendEscape

func AppendEscape(dst []byte, s string) []byte

AppendEscape appends Escape(s) to dst.

func AppendJoin

func AppendJoin(dst []byte, sep byte, fields ...string) []byte

AppendJoin appends Join(sep, fields...) to dst.

func Escape

func Escape(s string) string

Escape encodes s as one field.

func Join

func Join(sep byte, fields ...string) string

Join escapes each field and joins them with sep. It panics on no fields, whose key would be one empty field's, and on a separator Escape could write.

func Split

func Split(key string, sep byte) ([]string, error)

Split reverses Join: the fields of key, each unescaped. It panics on a separator Join would refuse.

func Unescape

func Unescape(s string) (string, error)

Unescape reverses Escape. It is url.PathUnescape: %XX in either hex case decodes, and any other byte reads as itself, so a field another writer left partly unescaped — an earlier build's %2D included — still reads.

Types

This section is empty.

Jump to

Keyboard shortcuts

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