Documentation
¶
Index ¶
- Constants
- type RemoteMap
- func (rm *RemoteMap) GetBool(key string) (bool, bool)
- func (rm *RemoteMap) GetBoolMap(key string) (map[string]bool, bool)
- func (rm *RemoteMap) GetBoolMapWithDefault(key string, defaultValue map[string]bool) map[string]bool
- func (rm *RemoteMap) GetBoolWithDefault(key string, defaultValue bool) bool
- func (rm *RemoteMap) GetFloat(key string) (float64, bool)
- func (rm *RemoteMap) GetFloatWithDefault(key string, defaultValue float64) float64
- func (rm *RemoteMap) GetInt(key string) (int, bool)
- func (rm *RemoteMap) GetInt64(key string) (int64, bool)
- func (rm *RemoteMap) GetInt64WithDefault(key string, defaultValue int64) int64
- func (rm *RemoteMap) GetIntWithDefault(key string, defaultValue int) int
- func (rm *RemoteMap) GetMap(key string) (map[string]interface{}, bool)
- func (rm *RemoteMap) GetMapWithDefault(key string, defaultValue map[string]interface{}) map[string]interface{}
- func (rm *RemoteMap) GetString(key string) (string, bool)
- func (rm *RemoteMap) GetStringMap(key string) (map[string]string, bool)
- func (rm *RemoteMap) GetStringMapWithDefault(key string, defaultValue map[string]string) map[string]string
- func (rm *RemoteMap) GetStringSlice(key string) ([]string, bool)
- func (rm *RemoteMap) GetStringSliceMap(key string) (map[string][]string, bool)
- func (rm *RemoteMap) GetStringSliceMapWithDefault(key string, defaultValue map[string][]string) map[string][]string
- func (rm *RemoteMap) GetStringSliceWithDefault(key string, defaultValue []string) []string
- func (rm *RemoteMap) GetStringWithDefault(key string, defaultValue string) string
- func (rm *RemoteMap) Keys() []string
- func (rm *RemoteMap) Load(key interface{}) (interface{}, bool)
- func (rm *RemoteMap) LoadOrStore(key string, defaultValue interface{}) (interface{}, bool)
- func (rm *RemoteMap) Refresh() error
- func (rm *RemoteMap) Start() *RemoteMap
- func (rm *RemoteMap) Started() bool
- func (rm *RemoteMap) Stop() *RemoteMap
- func (rm *RemoteMap) WithDeleteCallback(callback func([]string)) *RemoteMap
- func (rm *RemoteMap) WithErrorHandler(handler func(error)) *RemoteMap
- func (rm *RemoteMap) WithHeader(key, value string) *RemoteMap
- func (rm *RemoteMap) WithHeaders(headers map[string]string) *RemoteMap
- func (rm *RemoteMap) WithIgnoreTLSVerify(ignore bool) *RemoteMap
- func (rm *RemoteMap) WithRefreshCallback(callback func()) *RemoteMap
- func (rm *RemoteMap) WithRefreshPeriod(period time.Duration) *RemoteMap
- func (rm *RemoteMap) WithTimeout(timeout time.Duration) *RemoteMap
- func (rm *RemoteMap) WithTransformFunc(transform func(map[string]interface{}) map[string]interface{}) *RemoteMap
- func (rm *RemoteMap) WithUpdateCallback(callback func([]string)) *RemoteMap
Constants ¶
const DefaultRefreshPeriod = 5 * time.Minute
DefaultRefreshPeriod is the default time between refreshes of the remote data
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the default timeout for HTTP requests
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RemoteMap ¶
RemoteMap extends sync.Map to synchronize with a remote JSON endpoint
func NewRemoteMap ¶
NewRemoteMap creates a new RemoteMap that synchronizes with the provided URL
func (*RemoteMap) GetBoolMap ¶
GetBoolMap retrieves a map of boolean values from the map
func (*RemoteMap) GetBoolMapWithDefault ¶
func (rm *RemoteMap) GetBoolMapWithDefault(key string, defaultValue map[string]bool) map[string]bool
GetBoolMapWithDefault retrieves a map of boolean values from the map or returns a default value if not found
func (*RemoteMap) GetBoolWithDefault ¶
GetBoolWithDefault retrieves a bool value from the map or returns a default value if not found
func (*RemoteMap) GetFloatWithDefault ¶
GetFloatWithDefault retrieves a float64 value from the map or returns a default value if not found
func (*RemoteMap) GetInt64WithDefault ¶
GetInt64WithDefault retrieves an int64 value from the map or returns a default value if not found
func (*RemoteMap) GetIntWithDefault ¶
GetIntWithDefault retrieves an int value from the map or returns a default value if not found
func (*RemoteMap) GetMapWithDefault ¶
func (rm *RemoteMap) GetMapWithDefault(key string, defaultValue map[string]interface{}) map[string]interface{}
GetMapWithDefault retrieves a nested map from the map or returns a default value if not found
func (*RemoteMap) GetStringMap ¶
GetStringMap retrieves a map of string values from the map
func (*RemoteMap) GetStringMapWithDefault ¶
func (rm *RemoteMap) GetStringMapWithDefault(key string, defaultValue map[string]string) map[string]string
GetStringMapWithDefault retrieves a map of string values from the map or returns a default value if not found
func (*RemoteMap) GetStringSlice ¶
GetStringSlice retrieves a slice of strings from the map
func (*RemoteMap) GetStringSliceMap ¶
GetStringSliceMap retrieves a map of string slice values from the map
func (*RemoteMap) GetStringSliceMapWithDefault ¶
func (rm *RemoteMap) GetStringSliceMapWithDefault(key string, defaultValue map[string][]string) map[string][]string
GetStringSliceMapWithDefault retrieves a map of string slice values from the map or returns a default value if not found
func (*RemoteMap) GetStringSliceWithDefault ¶
GetStringSliceWithDefault retrieves a slice of strings from the map or returns a default value if not found
func (*RemoteMap) GetStringWithDefault ¶
GetStringWithDefault retrieves a string value from the map or returns a default value if not found
func (*RemoteMap) Load ¶
Load retrieves a value from the map This is an override of sync.Map's Load method to handle type conversions
func (*RemoteMap) LoadOrStore ¶
LoadOrStore loads the value for a key or stores the default value if it doesn't exist Returns the actual value and a boolean indicating whether the value was loaded
func (*RemoteMap) Refresh ¶
Refresh immediately updates the map from the remote URL and returns any error
func (*RemoteMap) Start ¶
Start begins the periodic refresh of the map from the remote URL and returns the RemoteMap for chaining
func (*RemoteMap) Stop ¶
Stop halts the periodic refresh of the map and returns the RemoteMap for chaining
func (*RemoteMap) WithDeleteCallback ¶
WithDeleteCallback sets a function to be called when keys are deleted from the map
func (*RemoteMap) WithErrorHandler ¶
WithErrorHandler sets a function to be called when an error occurs during refresh
func (*RemoteMap) WithHeader ¶
WithHeader adds an HTTP header to include in requests
func (*RemoteMap) WithHeaders ¶
WithHeaders sets all HTTP headers to include in requests
func (*RemoteMap) WithIgnoreTLSVerify ¶
WithIgnoreTLSVerify sets whether to disable TLS certificate verification
func (*RemoteMap) WithRefreshCallback ¶
WithRefreshCallback sets a function to be called after each refresh operation
func (*RemoteMap) WithRefreshPeriod ¶
WithRefreshPeriod sets the time between refreshes of the remote data
func (*RemoteMap) WithTimeout ¶
WithTimeout sets the timeout for HTTP requests
func (*RemoteMap) WithTransformFunc ¶
func (rm *RemoteMap) WithTransformFunc(transform func(map[string]interface{}) map[string]interface{}) *RemoteMap
WithTransformFunc sets a function to transform the fetched data before storing
func (*RemoteMap) WithUpdateCallback ¶
WithUpdateCallback sets a function to be called when keys are updated in the map