mirror of
https://github.com/hanzoai/insights-go.git
synced 2026-09-30 22:46:12 +00:00
71 lines
1.8 KiB
Go
71 lines
1.8 KiB
Go
package insights
|
|
|
|
import "context"
|
|
|
|
type noopClient struct {
|
|
Config
|
|
}
|
|
|
|
var (
|
|
emptyFlagValues = map[string]interface{}{}
|
|
emptyEvaluatedFlagRecords = map[string]evaluatedFlagRecord{}
|
|
noopFeatureFlagResult = &FeatureFlagResult{Enabled: false}
|
|
noopFeatureFlagEvaluations = &FeatureFlagEvaluations{flags: emptyEvaluatedFlagRecords}
|
|
)
|
|
|
|
func newNoopClient(config Config) Client {
|
|
return &noopClient{Config: config}
|
|
}
|
|
|
|
func (c *noopClient) Enqueue(Message) error {
|
|
return ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) EnqueueWithContext(context.Context, Message) error {
|
|
return ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) IsFeatureEnabled(FeatureFlagPayload) (interface{}, error) {
|
|
return false, ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) GetFeatureFlag(FeatureFlagPayload) (interface{}, error) {
|
|
return false, ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) GetFeatureFlagResult(FeatureFlagPayload) (*FeatureFlagResult, error) {
|
|
return noopFeatureFlagResult, ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) GetFeatureFlagPayload(FeatureFlagPayload) (string, error) {
|
|
return "", ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) GetRemoteConfigPayload(string) (string, error) {
|
|
return "", ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) GetAllFlags(FeatureFlagPayloadNoKey) (map[string]interface{}, error) {
|
|
return emptyFlagValues, ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) EvaluateFlags(EvaluateFlagsPayload) (*FeatureFlagEvaluations, error) {
|
|
return noopFeatureFlagEvaluations, ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) EvaluateFlagsWithContext(context.Context, EvaluateFlagsPayload) (*FeatureFlagEvaluations, error) {
|
|
return noopFeatureFlagEvaluations, ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) ReloadFeatureFlags() error {
|
|
return ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) Close() error {
|
|
return ErrSDKDisabled
|
|
}
|
|
|
|
func (c *noopClient) CloseWithContext(context.Context) error {
|
|
return ErrSDKDisabled
|
|
}
|