refer

package module
v0.0.0-...-a36a81d Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 7 Imported by: 0

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

func LoadFromStore[T any](ctx context.Context, store *configstore.Store, key string) (T, error)

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.

Jump to

Keyboard shortcuts

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