Documentation
¶
Overview ¶
This file is auto generated; DO NOT EDIT IT.
Index ¶
- func AddFile(p string)
- func AddPath(p string)
- func AddPflag(name string, f *pflag.Flag)
- func Bind(prefix string, v any) error
- func Changed(key string) bool
- func DeepMerge(dst, src map[string]any) map[string]any
- func FindPath(base, input string) (string, error)
- func Get(key string) any
- func GetBool(key string) bool
- func GetBoolE(key string) (bool, error)
- func GetBoolMust(key string) bool
- func GetConfigFiles() []string
- func GetE(key string) (any, error)
- func GetInt(key string) int
- func GetInt64(key string) int64
- func GetInt64E(key string) (int64, error)
- func GetInt64Must(key string) int64
- func GetIntE(key string) (int, error)
- func GetIntMust(key string) int
- func GetLogger() *slog.Logger
- func GetMust(key string) any
- func GetReflection(key string) reflect.Value
- func GetReflectionE(key string) (reflect.Value, error)
- func GetReflectionMust(key string) reflect.Value
- func GetString(key string) string
- func GetStringE(key string) (string, error)
- func GetStringMap(key string) map[string]any
- func GetStringMapBool(key string) map[string]bool
- func GetStringMapBoolE(key string) (map[string]bool, error)
- func GetStringMapBoolMust(key string) map[string]bool
- func GetStringMapE(key string) (map[string]any, error)
- func GetStringMapInt(key string) map[string]int
- func GetStringMapInt64(key string) map[string]int64
- func GetStringMapInt64E(key string) (map[string]int64, error)
- func GetStringMapInt64Must(key string) map[string]int64
- func GetStringMapIntE(key string) (map[string]int, error)
- func GetStringMapIntMust(key string) map[string]int
- func GetStringMapMust(key string) map[string]any
- func GetStringMapString(key string) map[string]string
- func GetStringMapStringE(key string) (map[string]string, error)
- func GetStringMapStringMust(key string) map[string]string
- func GetStringMapStringSlice(key string) map[string][]string
- func GetStringMapStringSliceE(key string) (map[string][]string, error)
- func GetStringMapStringSliceMust(key string) map[string][]string
- func GetStringMapUint(key string) map[string]uint
- func GetStringMapUint64(key string) map[string]uint64
- func GetStringMapUint64E(key string) (map[string]uint64, error)
- func GetStringMapUint64Must(key string) map[string]uint64
- func GetStringMapUintE(key string) (map[string]uint, error)
- func GetStringMapUintMust(key string) map[string]uint
- func GetStringMust(key string) string
- func GetUint(key string) uint
- func GetUint64(key string) uint64
- func GetUint64E(key string) (uint64, error)
- func GetUint64Must(key string) uint64
- func GetUintE(key string) (uint, error)
- func GetUintMust(key string) uint
- func Keys() []string
- func Must[T any](v T, err error) T
- func ReadConfig() error
- func Set(key string, v any) error
- func SetDefault(key string, v any) error
- func SetEnvPrefix(p string)
- func SetFormat(f string)
- func SetLogger(l *slog.Logger)
- func SetPflagSet(fs *pflag.FlagSet)
- func Settings() map[string]any
- func Should[T any](v T, _ error) T
- func Validate(sf reflect.StructField, sfv reflect.Value, changed bool) error
- type Config
- func (c *Config) AddFile(p string)
- func (c *Config) AddPath(p string)
- func (c *Config) AddPflag(name string, f *pflag.Flag)
- func (c *Config) Bind(prefix string, v any) error
- func (c *Config) Changed(key string) bool
- func (c *Config) Get(key string) any
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetBoolE(key string) (bool, error)
- func (c *Config) GetBoolMust(key string) bool
- func (c *Config) GetConfigFiles() []string
- func (c *Config) GetE(key string) (any, error)
- func (c *Config) GetInt(key string) int
- func (c *Config) GetInt64(key string) int64
- func (c *Config) GetInt64E(key string) (int64, error)
- func (c *Config) GetInt64Must(key string) int64
- func (c *Config) GetIntE(key string) (int, error)
- func (c *Config) GetIntMust(key string) int
- func (c *Config) GetLogger() *slog.Logger
- func (c *Config) GetMust(key string) any
- func (c *Config) GetReflection(key string) reflect.Value
- func (c *Config) GetReflectionE(key string) (reflect.Value, error)
- func (c *Config) GetReflectionMust(key string) reflect.Value
- func (c *Config) GetString(key string) string
- func (c *Config) GetStringE(key string) (string, error)
- func (c *Config) GetStringMap(key string) map[string]any
- func (c *Config) GetStringMapBool(key string) map[string]bool
- func (c *Config) GetStringMapBoolE(key string) (map[string]bool, error)
- func (c *Config) GetStringMapBoolMust(key string) map[string]bool
- func (c *Config) GetStringMapE(key string) (map[string]any, error)
- func (c *Config) GetStringMapInt(key string) map[string]int
- func (c *Config) GetStringMapInt64(key string) map[string]int64
- func (c *Config) GetStringMapInt64E(key string) (map[string]int64, error)
- func (c *Config) GetStringMapInt64Must(key string) map[string]int64
- func (c *Config) GetStringMapIntE(key string) (map[string]int, error)
- func (c *Config) GetStringMapIntMust(key string) map[string]int
- func (c *Config) GetStringMapMust(key string) map[string]any
- func (c *Config) GetStringMapString(key string) map[string]string
- func (c *Config) GetStringMapStringE(key string) (map[string]string, error)
- func (c *Config) GetStringMapStringMust(key string) map[string]string
- func (c *Config) GetStringMapStringSlice(key string) map[string][]string
- func (c *Config) GetStringMapStringSliceE(key string) (map[string][]string, error)
- func (c *Config) GetStringMapStringSliceMust(key string) map[string][]string
- func (c *Config) GetStringMapUint(key string) map[string]uint
- func (c *Config) GetStringMapUint64(key string) map[string]uint64
- func (c *Config) GetStringMapUint64E(key string) (map[string]uint64, error)
- func (c *Config) GetStringMapUint64Must(key string) map[string]uint64
- func (c *Config) GetStringMapUintE(key string) (map[string]uint, error)
- func (c *Config) GetStringMapUintMust(key string) map[string]uint
- func (c *Config) GetStringMust(key string) string
- func (c *Config) GetUint(key string) uint
- func (c *Config) GetUint64(key string) uint64
- func (c *Config) GetUint64E(key string) (uint64, error)
- func (c *Config) GetUint64Must(key string) uint64
- func (c *Config) GetUintE(key string) (uint, error)
- func (c *Config) GetUintMust(key string) uint
- func (c *Config) Keys() []string
- func (c *Config) ReadConfig() error
- func (c *Config) Set(key string, v any) error
- func (c *Config) SetDefault(key string, v any) error
- func (c *Config) SetEnvPrefix(p string)
- func (c *Config) SetFormat(f string)
- func (c *Config) SetLogger(l *slog.Logger)
- func (c *Config) SetPflagSet(fs *pflag.FlagSet)
- func (c *Config) Settings() map[string]any
- type DecodeFunc
- type EncodeFunc
- type Key
- type KeyError
- type KeyKind
- type KeyPart
- type MarshalFunc
- type UnmarshalFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFile ¶
func AddFile(p string)
AddFile adds a specific file path to the Config instance, marking it to be loaded as a configuration file. The file is added to both the fullPath map (to track specific files) and the general paths list (for search purposes). This allows for both explicit file loading and path-based searching.
func AddPath ¶
func AddPath(p string)
AddPath adds a file path to the Config instance's list of search paths. These paths will be used when looking for configuration files to load. Duplicate paths may be added.
func Bind ¶
Bind maps configuration values from the Config instance into a structured Go type. It uses struct tags to determine how to bind the data and can also perform validation.
Parameters:
- prefix: The prefix to prepend to all configuration keys
- v: A pointer to a struct where the configuration values will be populated
Returns:
- error: If the input is not a non-nil pointer, or if binding fails
func DeepMerge ¶
DeepMerge recursively merges src into dst, combining nested maps rather than replacing them. Non-map values in src overwrite those in dst. Both maps must have string keys. Returns the updated dst.
Example:
dst = { "a": { "x": 1 }, "b": 2 }
src = { "a": { "y": 3 }, "b": 4 }
DeepMerge(dst, src) → { "a": { "x": 1, "y": 3 }, "b": 4 }
func FindPath ¶
FindPath expands environment-aware variables and returns an absolute path from a given base path (not CWD). Path Prefix Expands:
- $HOME or ~ : xdg.Home
- $XDG_CONFIG_HOME : xdg.ConfigHome
- $XDG_CACHE_HOME : xdg.CacheHome
- $XDG_DATA_HOME : xdg.DataHome
- $TMPDIR : os.TempDir()
- $PWD : Current Working Directorie
- $XDG_DESKTOP_DIR : xdg.UserDirs.Desktop
- $XDG_DOCUMENTS_DIR : xdg.UserDirs.Documents
- $XDG_DOWNLOAD_DIR : xdg.UserDirs.Download
- $XDG_MUSIC_DIR : xdg.UserDirs.Music
- $XDG_PICTURES_DIR : xdg.UserDirs.Pictures
- $XDG_PUBLICSHARE_DIR : xdg.UserDirs.PublicShare
- $XDG_TEMPLATES_DIR : xdg.UserDirs.Templates
- $XDG_VIDEOS_DIR : xdg.UserDirs.Videos
func GetBoolMust ¶
GetBoolMust returns the bool value for the key. Panics if missing/invalid.
func GetConfigFiles ¶
func GetConfigFiles() []string
GetConfigFiles returns all config file paths to be loaded by ReadConfig. It resolves registered files (AddFile) and directories (AddPath), matching the config filename across supported extensions. Missing or invalid paths are skipped with debug logs. Paths are returned in registration order.
Example: fileName "config", path "/etc/app" → matches "/etc/app/config.json", "/etc/app/config.yaml", etc.
func GetInt64Must ¶
GetInt64Must returns the int64 value for the key. Panics if missing/invalid.
func GetIntMust ¶
GetIntMust returns the int value for the key. Panics if missing/invalid.
func GetReflection ¶
GetReflection returns the reflection value for the key. Returns default if missing/invalid.
func GetReflectionE ¶
GetReflectionE returns the reflection value for the key, or error if missing/invalid.
func GetReflectionMust ¶
GetReflectionMust returns the reflection value for the key. Panics if missing/invalid.
func GetString ¶
GetString returns the string value for the key. Returns default if missing/invalid.
func GetStringE ¶
GetStringE returns the string value for the key, or error if missing/invalid.
func GetStringMap ¶
GetStringMap returns the stringmap value for the key. Returns default if missing/invalid.
func GetStringMapBool ¶
GetStringMapBool returns the stringmapbool value for the key. Returns default if missing/invalid.
func GetStringMapBoolE ¶
GetStringMapBoolE returns the stringmapbool value for the key, or error if missing/invalid.
func GetStringMapBoolMust ¶
GetStringMapBoolMust returns the stringmapbool value for the key. Panics if missing/invalid.
func GetStringMapE ¶
GetStringMapE returns the stringmap value for the key, or error if missing/invalid.
func GetStringMapInt ¶
GetStringMapInt returns the stringmapint value for the key. Returns default if missing/invalid.
func GetStringMapInt64 ¶
GetStringMapInt64 returns the stringmapint64 value for the key. Returns default if missing/invalid.
func GetStringMapInt64E ¶
GetStringMapInt64E returns the stringmapint64 value for the key, or error if missing/invalid.
func GetStringMapInt64Must ¶
GetStringMapInt64Must returns the stringmapint64 value for the key. Panics if missing/invalid.
func GetStringMapIntE ¶
GetStringMapIntE returns the stringmapint value for the key, or error if missing/invalid.
func GetStringMapIntMust ¶
GetStringMapIntMust returns the stringmapint value for the key. Panics if missing/invalid.
func GetStringMapMust ¶
GetStringMapMust returns the stringmap value for the key. Panics if missing/invalid.
func GetStringMapString ¶
GetStringMapString returns the stringmapstring value for the key. Returns default if missing/invalid.
func GetStringMapStringE ¶
GetStringMapStringE returns the stringmapstring value for the key, or error if missing/invalid.
func GetStringMapStringMust ¶
GetStringMapStringMust returns the stringmapstring value for the key. Panics if missing/invalid.
func GetStringMapStringSlice ¶
GetStringMapStringSlice returns the stringmapstringslice value for the key. Returns default if missing/invalid.
func GetStringMapStringSliceE ¶
GetStringMapStringSliceE returns the stringmapstringslice value for the key, or error if missing/invalid.
func GetStringMapStringSliceMust ¶
GetStringMapStringSliceMust returns the stringmapstringslice value for the key. Panics if missing/invalid.
func GetStringMapUint ¶
GetStringMapUint returns the stringmapuint value for the key. Returns default if missing/invalid.
func GetStringMapUint64 ¶
GetStringMapUint64 returns the stringmapuint64 value for the key. Returns default if missing/invalid.
func GetStringMapUint64E ¶
GetStringMapUint64E returns the stringmapuint64 value for the key, or error if missing/invalid.
func GetStringMapUint64Must ¶
GetStringMapUint64Must returns the stringmapuint64 value for the key. Panics if missing/invalid.
func GetStringMapUintE ¶
GetStringMapUintE returns the stringmapuint value for the key, or error if missing/invalid.
func GetStringMapUintMust ¶
GetStringMapUintMust returns the stringmapuint value for the key. Panics if missing/invalid.
func GetStringMust ¶
GetStringMust returns the string value for the key. Panics if missing/invalid.
func GetUint64 ¶
GetUint64 returns the uint64 value for the key. Returns default if missing/invalid.
func GetUint64E ¶
GetUint64E returns the uint64 value for the key, or error if missing/invalid.
func GetUint64Must ¶
GetUint64Must returns the uint64 value for the key. Panics if missing/invalid.
func GetUintMust ¶
GetUintMust returns the uint value for the key. Panics if missing/invalid.
func ReadConfig ¶
func ReadConfig() error
ReadConfig loads config files from GetConfigFiles(), following any "include" directives to merge additional files recursively. Later values override earlier ones.
Example:
main.json:
{ "include": ["a.yaml"], "app": { "port": "8080" } }
a.yaml:
app: { "port": 9000, "env": "prod" }
Result:
app.port = "8080" // overridden by main.json app.env = "prod" // merged from a.yaml
func SetDefault ¶
SetDefault sets a value in the configuration's default values under the specified key.
func SetEnvPrefix ¶
func SetEnvPrefix(p string)
SetEnvPrefix sets the environment variable prefix for the configuration. All underscores in the provided string are removed before assignment.
For example, calling SetEnvPrefix("APP_") will set the prefix to "APP".
func SetFormat ¶
func SetFormat(f string)
SetFormat sets the default configuration format for this Config instance. The format will be used when no specific encoder/decoder is available for a requested format. Typical formats include "json", "yaml", "toml", etc.
func Validate ¶
Validate applies validation rules to a given struct field based on its "check" tag.
It supports the following rules:
- required: Field must be changed from its zero value (checked via the `changed` flag).
- default: If the field is zero-valued, sets it to the specified default value (supports string, int, uint, float, bool).
- enum: Ensures the field is a one of the given comma (,) sperated enum. Note: enum must be inside a qoute. enum='a,b,c'
- base64: Ensures the field is a valid base64-encoded string (length, character set, padding).
- email: Ensures the field is a valid email address without a display name.
- uuid: Ensures the field is a valid UUID.
- alpha: Field must contain only alphabetic letters (A-Z, a-z).
- alphanumeric: Field must contain only letters or digits.
- number: Field must contain only digits (0-9).
- match: Field must match the provided regular expression pattern.
- min: For strings, arrays, slices, channels, and maps, enforces a minimum length; for integers/unsigned integers, enforces a minimum numeric value.
- max: For strings, arrays, slices, channels, and maps, enforces a maximum length; for integers/unsigned integers, enforces a maximum numeric value.
Parameters:
- sf: The struct field metadata.
- sfv: The reflect.Value of the struct field.
- changed: Indicates whether the field value has been modified from its original state.
Returns:
- error: A descriptive error if validation fails, or nil if all rules pass.
Panics if:
- An unknown validation rule is provided.
- A rule is applied to an unsupported type.
- "default" rule is applied to an unsupported kind.
- Type mismatches occur for rules like base64, email, uuid, alpha, alphanumeric, number, or match.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents an application configuration container. It holds configuration values loaded from files, environment variables, or other sources. The struct also manages metadata and encoding/decoding behavior for configuration data.
func (*Config) AddFile ¶
AddFile adds a specific file path to the Config instance, marking it to be loaded as a configuration file. The file is added to both the fullPath map (to track specific files) and the general paths list (for search purposes). This allows for both explicit file loading and path-based searching.
func (*Config) AddPath ¶
AddPath adds a file path to the Config instance's list of search paths. These paths will be used when looking for configuration files to load. Duplicate paths may be added.
func (*Config) Bind ¶
Bind maps configuration values from the Config instance into a structured Go type. It uses struct tags to determine how to bind the data and can also perform validation.
Parameters:
- prefix: The prefix to prepend to all configuration keys
- v: A pointer to a struct where the configuration values will be populated
Returns:
- error: If the input is not a non-nil pointer, or if binding fails
func (*Config) GetBool ¶
GetBool returns the bool value for the key. Returns default if missing/invalid.
func (*Config) GetBoolMust ¶
GetBoolMust returns the bool value for the key. Panics if missing/invalid.
func (*Config) GetConfigFiles ¶
GetConfigFiles returns all config file paths to be loaded by ReadConfig. It resolves registered files (AddFile) and directories (AddPath), matching the config filename across supported extensions. Missing or invalid paths are skipped with debug logs. Paths are returned in registration order.
Example: fileName "config", path "/etc/app" → matches "/etc/app/config.json", "/etc/app/config.yaml", etc.
func (*Config) GetInt ¶
GetInt returns the int value for the key. Returns default if missing/invalid.
func (*Config) GetInt64 ¶
GetInt64 returns the int64 value for the key. Returns default if missing/invalid.
func (*Config) GetInt64E ¶
GetInt64E returns the int64 value for the key, or error if missing/invalid.
func (*Config) GetInt64Must ¶
GetInt64Must returns the int64 value for the key. Panics if missing/invalid.
func (*Config) GetIntMust ¶
GetIntMust returns the int value for the key. Panics if missing/invalid.
func (*Config) GetLogger ¶
GetLogger returns the configured logger, or a no-op logger if none is set.
func (*Config) GetReflection ¶
GetReflection returns the reflection value for the key. Returns default if missing/invalid.
func (*Config) GetReflectionE ¶
GetReflectionE returns the reflect.Value for the key, or error if missing/invalid.
func (*Config) GetReflectionMust ¶
GetReflectionMust returns the reflection value for the key. Panics if missing/invalid.
func (*Config) GetString ¶
GetString returns the string value for the key. Returns default if missing/invalid.
func (*Config) GetStringE ¶
GetStringE returns the string value for the key, or error if missing/invalid.
func (*Config) GetStringMap ¶
GetStringMap returns the stringmap value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapBool ¶
GetStringMapBool returns the stringmapbool value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapBoolE ¶
GetStringMapBoolE returns the map[string]bool value for the key, or error if missing/invalid.
func (*Config) GetStringMapBoolMust ¶
GetStringMapBoolMust returns the stringmapbool value for the key. Panics if missing/invalid.
func (*Config) GetStringMapE ¶
GetStringMapE returns the map[string]any value for the key, or error if missing/invalid.
func (*Config) GetStringMapInt ¶
GetStringMapInt returns the stringmapint value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapInt64 ¶
GetStringMapInt64 returns the stringmapint64 value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapInt64E ¶
GetStringMapInt64E returns the map[string]int64 value for the key, or error if missing/invalid.
func (*Config) GetStringMapInt64Must ¶
GetStringMapInt64Must returns the stringmapint64 value for the key. Panics if missing/invalid.
func (*Config) GetStringMapIntE ¶
GetStringMapIntE returns the map[string]any value for the key, or error if missing/invalid.
func (*Config) GetStringMapIntMust ¶
GetStringMapIntMust returns the stringmapint value for the key. Panics if missing/invalid.
func (*Config) GetStringMapMust ¶
GetStringMapMust returns the stringmap value for the key. Panics if missing/invalid.
func (*Config) GetStringMapString ¶
GetStringMapString returns the stringmapstring value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapStringE ¶
GetStringMapStringE returns the map[string]string value for the key, or error if missing/invalid.
func (*Config) GetStringMapStringMust ¶
GetStringMapStringMust returns the stringmapstring value for the key. Panics if missing/invalid.
func (*Config) GetStringMapStringSlice ¶
GetStringMapStringSlice returns the stringmapstringslice value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapStringSliceE ¶
GetStringMapStringSliceE returns the map[string][]string value for the key, or error if missing/invalid.
func (*Config) GetStringMapStringSliceMust ¶
GetStringMapStringSliceMust returns the stringmapstringslice value for the key. Panics if missing/invalid.
func (*Config) GetStringMapUint ¶
GetStringMapUint returns the stringmapuint value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapUint64 ¶
GetStringMapUint64 returns the stringmapuint64 value for the key. Returns default if missing/invalid.
func (*Config) GetStringMapUint64E ¶
GetStringMapUint64E returns the map[string]uint64 value for the key, or error if missing/invalid.
func (*Config) GetStringMapUint64Must ¶
GetStringMapUint64Must returns the stringmapuint64 value for the key. Panics if missing/invalid.
func (*Config) GetStringMapUintE ¶
GetStringMapUintE returns the map[string]uint value for the key, or error if missing/invalid.
func (*Config) GetStringMapUintMust ¶
GetStringMapUintMust returns the stringmapuint value for the key. Panics if missing/invalid.
func (*Config) GetStringMust ¶
GetStringMust returns the string value for the key. Panics if missing/invalid.
func (*Config) GetUint ¶
GetUint returns the uint value for the key. Returns default if missing/invalid.
func (*Config) GetUint64 ¶
GetUint64 returns the uint64 value for the key. Returns default if missing/invalid.
func (*Config) GetUint64E ¶
GetUint64E returns the uint64 value for the key, or error if missing/invalid.
func (*Config) GetUint64Must ¶
GetUint64Must returns the uint64 value for the key. Panics if missing/invalid.
func (*Config) GetUintMust ¶
GetUintMust returns the uint value for the key. Panics if missing/invalid.
func (*Config) ReadConfig ¶
ReadConfig loads config files from GetConfigFiles(), following any "include" directives to merge additional files recursively. Later values override earlier ones.
Example:
main.json:
{ "include": ["a.yaml"], "app": { "port": "8080" } }
a.yaml:
app: { "port": 9000, "env": "prod" }
Result:
app.port = "8080" // overridden by main.json app.env = "prod" // merged from a.yaml
func (*Config) SetDefault ¶
SetDefault sets a value in the configuration's default values under the specified key.
func (*Config) SetEnvPrefix ¶
SetEnvPrefix sets the environment variable prefix for the configuration. All underscores in the provided string are removed before assignment.
For example, calling SetEnvPrefix("APP_") will set the prefix to "APP".
func (*Config) SetFormat ¶
SetFormat sets the default configuration format for this Config instance. The format will be used when no specific encoder/decoder is available for a requested format. Typical formats include "json", "yaml", "toml", etc.
func (*Config) SetPflagSet ¶
SetPflagSet adds *pflag.FlagSet
type DecodeFunc ¶
DecodeFunc decodes raw bytes into a generic map representation of a config file.
func DecoderFromUnmarshal ¶
func DecoderFromUnmarshal(unmarshall UnmarshalFunc) DecodeFunc
DecoderFromUnmarshal wraps a standard UnmarshalFunc (e.g., YAML, JSON) into a DecodeFunc that produces a map[string]any suitable for generic config handling.
type EncodeFunc ¶
EncodeFunc encodes a generic config map into raw bytes for storage or transmission.
func EncoderFromMarshal ¶
func EncoderFromMarshal(marshall MarshalFunc) EncodeFunc
EncoderFromMarshal wraps a standard MarshalFunc into an EncodeFunc that serializes a map[string]any into raw bytes.
type Key ¶
Key parsed key for easy uses
func KeySplit ¶
KeySplit parses a dotted key path into parts, respecting quotes. Example:
"a.b.c" -> {"a", "b", "c"} "a.'b.c'.\"c\"" -> {"a", "b.c", "c"} "'a.b'.c" -> {"a.b", "c"}
type KeyPart ¶
KeyPart is a single key
type MarshalFunc ¶
MarshalFunc encodes a Go value into raw bytes (like json.Marshal).
type UnmarshalFunc ¶
UnmarshalFunc decodes raw bytes into a provided Go value (like json.Unmarshal).