 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
NewClient creates a new feature flag client with the given configuration. This is the primary constructor for creating a feature flag client.
The client will be configured according to the provided Config, including:
- Storage backend (memory, Redis, or PostgreSQL)
- Caching settings (TTL, max size, enabled/disabled)
- Observability settings (logging and metrics)
- Default flags to load on startup
Example usage:
config := featureflag.Config{
	Storage: featureflag.StorageConfig{
		Type: "redis",
		Redis: &featureflag.RedisConfig{
			Addr: "localhost:6379",
		},
	},
	Cache: featureflag.CacheConfig{
		Enabled: true,
		TTL:     featureflag.Duration(5 * time.Minute),
		MaxSize: 1000,
	},
}
client, err := featureflag.NewClient(config)
if err != nil {
	log.Fatal(err)
}
defer client.Close()
Parameters:
- config: Configuration for the client
Returns:
- Client: The configured client instance
- error: Configuration validation errors or initialization errors
func NewClientWithDefaults ¶
NewClientWithDefaults creates a new client with default configuration. This is a convenience constructor that uses sensible defaults:
- In-memory storage (no external dependencies)
- Caching enabled with 5-minute TTL and 1000 item limit
- Logging disabled
- Metrics disabled
- No default flags
This is ideal for development, testing, or simple use cases where you don't need persistent storage or advanced configuration.
Example usage:
client, err := featureflag.NewClientWithDefaults()
if err != nil {
	log.Fatal(err)
}
defer client.Close()
// Client is ready to use
enabled, _ := client.IsEnabled(ctx, "my-feature")
Returns:
- Client: The client with default configuration
- error: Initialization errors (rare with default config)
Types ¶
This section is empty.
 Click to show internal directories. 
   Click to hide internal directories.