Versions in this module Expand all Collapse all v1 v1.0.0 Sep 5, 2026 Changes in this version + const Version + func CRC32B(input string) uint32 + func IsInBucket(salt, contextIdentifier string, percentage int) bool + type APIClient struct + func NewAPIClient(cfg Config) *APIClient + func (c *APIClient) FetchRules(ctx context.Context) (RulesResponse, error) + func (c *APIClient) ReportUsage(ctx context.Context, key string, contextData *Context, defaultValue any) error + type Attribute struct + func NewAttribute(key string, values []string) Attribute + func (a *Attribute) AddValue(value string) + func (a Attribute) Key() string + func (a Attribute) Values() []string + type Cache interface + Clear func() error + Delete func(key string) error + Get func(key string) (value string, found bool, err error) + Set func(key, value string, ttl time.Duration) error + type Config struct + APIEndpoint string + CacheBackend string + CacheDirectory string + CacheTTL time.Duration + ClientAgent string + CustomCache Cache + EnableUsageReporting bool + EnvironmentToken string + HTTPClient *http.Client + Logger Logger + SDKVersion string + type ConfigBuilder struct + func ConfigFromEnvironment() *ConfigBuilder + func NewConfigBuilder() *ConfigBuilder + func (b *ConfigBuilder) Build() (Config, error) + func (b *ConfigBuilder) WithAPIEndpoint(endpoint string) *ConfigBuilder + func (b *ConfigBuilder) WithCache(cache Cache) *ConfigBuilder + func (b *ConfigBuilder) WithCacheBackend(backend string) *ConfigBuilder + func (b *ConfigBuilder) WithCacheDirectory(dir string) *ConfigBuilder + func (b *ConfigBuilder) WithCacheTTL(ttl time.Duration) *ConfigBuilder + func (b *ConfigBuilder) WithClientAgent(agent string) *ConfigBuilder + func (b *ConfigBuilder) WithEnvironmentToken(token string) *ConfigBuilder + func (b *ConfigBuilder) WithHTTPClient(client *http.Client) *ConfigBuilder + func (b *ConfigBuilder) WithLogger(logger Logger) *ConfigBuilder + func (b *ConfigBuilder) WithSDKVersion(version string) *ConfigBuilder + func (b *ConfigBuilder) WithUsageReporting(enabled bool) *ConfigBuilder + type ConfigurationError struct + Message string + func (e *ConfigurationError) Error() string + type Context struct + func ContextFromData(data ContextData) Context + func NewContext(typ, identifier, name string, attributes []Attribute) Context + func SingleContext(typ, identifier, name string) Context + func (c *Context) AddAttribute(attr Attribute) + func (c Context) Attributes() []ContextAttribute + func (c Context) Data() ContextData + func (c Context) GetAttribute(key string) (ContextAttribute, bool) + func (c Context) Identifier() string + func (c Context) IsEmpty() bool + func (c Context) JSON() ([]byte, error) + func (c Context) Name() string + func (c Context) Type() string + type ContextAttribute struct + Key string + Values []ContextValue + type ContextData struct + Attributes []ContextAttribute + Identifier string + Name string + Type string + type ContextValue struct + Value string + type DefaultsCollection struct + func DefaultsFromMap(values map[string]any) *DefaultsCollection + func NewDefaultsCollection() *DefaultsCollection + func (c *DefaultsCollection) All() map[string]any + func (c *DefaultsCollection) Clear() + func (c *DefaultsCollection) Delete(key string) + func (c *DefaultsCollection) Get(key string) (any, bool) + func (c *DefaultsCollection) Has(key string) bool + func (c *DefaultsCollection) Keys() []string + func (c *DefaultsCollection) Set(key string, value any) + func (c *DefaultsCollection) Size() int + type Error interface + type EvaluationError struct + Message string + func (e *EvaluationError) Error() string + type FetchRulesError struct + Message string + StatusCode int + func (e *FetchRulesError) Error() string + type FileSystemCache struct + func NewFileSystemCache(dir string) *FileSystemCache + func (c *FileSystemCache) Clear() error + func (c *FileSystemCache) Delete(key string) error + func (c *FileSystemCache) Get(key string) (string, bool, error) + func (c *FileSystemCache) Set(key, value string, ttl time.Duration) error + type Flag struct + func (f Flag) AsBool() bool + func (f Flag) AsNumber() float64 + func (f Flag) AsString() string + func (f Flag) IsEnabled() bool + func (f Flag) Key() string + func (f Flag) Name() string + func (f Flag) Rollout() *RolloutData + func (f Flag) Rules() []Rule + func (f Flag) Target() Target + func (f Flag) Type() FlagType + func (f Flag) Value() any + func (f Flag) Version() string + type FlagData struct + Key string + Name string + Rollout *RolloutData + Rules []Rule + Target Target + Type FlagType + Version string + type FlagManager struct + func NewFlagManager(apiClient *APIClient, cache Cache, ruleEngine *RuleEngine, ...) *FlagManager + func (m *FlagManager) All(ctx context.Context) ([]Flag, error) + func (m *FlagManager) RefreshRules(ctx context.Context) error + func (m *FlagManager) ReportUsage(ctx context.Context, key string, defaultValue any) error + func (m *FlagManager) Single(ctx context.Context, key string, inlineDefault ...any) (Flag, error) + func (m *FlagManager) WithContext(ctx Context) *FlagManager + func (m *FlagManager) WithDefaults(defaults *DefaultsCollection) *FlagManager + type FlagType string + const FlagTypeBoolean + const FlagTypeNumber + const FlagTypeString + type InMemoryCache struct + func NewInMemoryCache() *InMemoryCache + func (c *InMemoryCache) Clear() error + func (c *InMemoryCache) Delete(key string) error + func (c *InMemoryCache) Get(key string) (string, bool, error) + func (c *InMemoryCache) Set(key, value string, ttl time.Duration) error + type InvalidRulesError struct + Message string + func (e *InvalidRulesError) Error() string + type Logger interface + Debug func(message string, meta map[string]any) + Error func(message string, meta map[string]any) + Info func(message string, meta map[string]any) + Warn func(message string, meta map[string]any) + type NullCache struct + func NewNullCache() *NullCache + func (c *NullCache) Clear() error + func (c *NullCache) Delete(string) error + func (c *NullCache) Get(string) (string, bool, error) + func (c *NullCache) Set(string, string, time.Duration) error + type NullLogger struct + func (NullLogger) Debug(string, map[string]any) + func (NullLogger) Error(string, map[string]any) + func (NullLogger) Info(string, map[string]any) + func (NullLogger) Warn(string, map[string]any) + type RolloutData struct + Percentage int + Rules []Rule + Salt string + Status string + Target Target + type Rule struct + Clauses []RuleCondition + Criteria *RuleCondition + Description string + Position int + Value ValueEnvelope + Version string + type RuleCondition struct + Attribute string + Operator string + Value any + func (rc *RuleCondition) UnmarshalJSON(data []byte) error + type RuleContextTarget struct + Identifier string + Type *string + type RuleEngine struct + func NewRuleEngine() *RuleEngine + func (e *RuleEngine) Evaluate(rules []Rule, context Context) (*ValueEnvelope, error) + type RulesResponse struct + Flags []FlagData + Version string + type Target struct + ExpiredAt string + PublishedAt string + ScheduledAt string + Value ValueEnvelope + Version string + type ValueEnvelope struct + Value struct{ ... } + Version string + type Zenmanage struct + func New(config Config) *Zenmanage + func (z *Zenmanage) Flags() *FlagManager + func (z *Zenmanage) GetNumber(ctx context.Context, key, userID string, defaultValue float64) (float64, error) + func (z *Zenmanage) GetString(ctx context.Context, key, userID, defaultValue string) (string, error) + func (z *Zenmanage) IsEnabled(ctx context.Context, key, userID string) (bool, error)