mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-31 02:51:51 -07:00
## 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
22 lines
338 B
Go
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()
|
|
}
|