Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFromStore ¶
func GetFromStore(store *configstore.Store, key string, unmarshalAs any) (interface{}, error)
GetFromStore returns a single item from the given store, unmarshalled using the given type. unmarshalAs must be a pointer.
func GetFromStoreAs ¶
func GetFromStoreAs[T any](store *configstore.Store, key string) (T, error)
GetFromStoreAs returns a single typed item from the given store.
func LoadFromStore ¶
LoadFromStore gets an item from the given configstore.Store and follows `configstore` tags on fields of the given T type.
Tags must be in the following format: `configstore:"store-key[,expression]"`.
store-key refers to another entry in the given store. LoadFromStore will attempt to load an item by that name and set it as the value of the struct field. If no item is found, an error is returned.
expression is optional and assumes the entry referred to by store-key can be unmarshalled as map[string]any. It will be parsed by github.com/itchyny/gojq to retrieve a specific entry from the map and set it as the value of the struct field instead of the whole configstore item.
Types ¶
This section is empty.