func (f FeatureFlag) IsEnabled() bool {
	return f.Enabled || f.Percentage == 100
}
IsEnabled checks if a feature flag is enabled
package models
import (
	"fmt"
	"hash/crc32"
	"regexp"
	helpers "github.com/antoineaugusti/feature-flags/helpers"
)
type FeatureFlag struct {
	Key string `json:"key"`
	Enabled bool `json:"enabled"`
	Users []uint32 `json:"users"`
	Groups []string `json:"groups"`
	Percentage uint32 `json:"percentage"`
}
type FeatureFlags []FeatureFlag
func (f FeatureFlag) Validate() error {
	if f.Percentage < 0 || f.Percentage > 100 {
		return fmt.Errorf("Percentage must be between 0 and 100")
	}
	if len(f.Key) < 3 || len(f.Key) > 50 {
		return fmt.Errorf("Feature key must be between 3 and 50 characters")
	}
	if !regexp.MustCompile(`^[a-z0-9_]*$`).MatchString(f.Key) {
		return fmt.Errorf("Feature key must only contain digits, lowercase letters and underscores")
	}
	return nil
}