Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ValueLoaderFunc ¶
ValueLoaderFunc is called whenever the value for a given key is not present in the cache.
func AWSSecretsManagerLoader ¶
func AWSSecretsManagerLoader(secretArn string) (ValueLoaderFunc, error)
func EnvironmentLoader ¶
func EnvironmentLoader() (ValueLoaderFunc, error)
func JSONFileLoader ¶
func JSONFileLoader(filepath string) (ValueLoaderFunc, error)
func JSONLoader ¶
func JSONLoader(data []byte) (ValueLoaderFunc, error)
func RemoteJSONLoader ¶
func RemoteJSONLoader(url string) (ValueLoaderFunc, error)
type ValuesLoader ¶
type ValuesLoader struct {
// contains filtered or unexported fields
}
ValuesLoader loads and caches values based on keys. It gets the values from the ValueLoaderFunc provided.
func New ¶
func New(loaders ...ValueLoaderFunc) (*ValuesLoader, error)
New returns a new ValuesLoader instance or an error if the provided loader function is nil.
func (*ValuesLoader) Get ¶
func (v *ValuesLoader) Get(key string) string
Get works just like Lookup but without returning the boolean flag.
func (*ValuesLoader) Lookup ¶
func (v *ValuesLoader) Lookup(key string) (string, bool)
Loopup gets a value for a given key, it will first try to get the value from the cache, if it is not present in the cache it will call each ValueLoaderFunc in order. It returns true if the key was found, otherwise it returns false.
Click to show internal directories.
Click to hide internal directories.