Files
David Reiss 42d5b8a44b Use handle for dynamicconfig.Key (#8171)
## What changed?
Use unique.Handle for dynamicconfig.Keys instead of strings.

## Why?
Force keys to always be lowercase so we don't have to convert at lookup
time, and also speed up lookups by interning.

## How did you test it?
- [x] covered by existing tests
2025-12-05 12:22:39 -08:00

22 lines
338 B
Go

package dynamicconfig
import (
"strings"
"unique"
)
type (
// Key is a key/property stored in dynamic config.
Key struct {
handle unique.Handle[string] // string must be lower-case
}
)
func MakeKey(s string) Key {
return Key{handle: unique.Make(strings.ToLower(s))}
}
func (k Key) String() string {
return k.handle.Value()
}