()
| 339 | ) |
| 340 | |
| 341 | func (set FeatureSet) Features() []FeatureName { |
| 342 | switch FeatureSet(strings.ToLower(string(set))) { |
| 343 | case FeatureSetEnterprise: |
| 344 | // Enterprise is the set 'AllFeatures' minus some select features. |
| 345 | |
| 346 | // Copy the list of all features |
| 347 | enterpriseFeatures := make([]FeatureName, len(FeatureNames)) |
| 348 | copy(enterpriseFeatures, FeatureNames) |
| 349 | // Remove the selection |
| 350 | enterpriseFeatures = slices.DeleteFunc(enterpriseFeatures, func(f FeatureName) bool { |
| 351 | // TODO: In future release, restore the f.IsAddonFeature() check. |
| 352 | return !f.Enterprise() || f.UsesLimit() |
| 353 | }) |
| 354 | |
| 355 | return enterpriseFeatures |
| 356 | case FeatureSetPremium: |
| 357 | premiumFeatures := make([]FeatureName, len(FeatureNames)) |
| 358 | copy(premiumFeatures, FeatureNames) |
| 359 | // Remove the selection |
| 360 | premiumFeatures = slices.DeleteFunc(premiumFeatures, func(f FeatureName) bool { |
| 361 | // TODO: In future release, restore the f.IsAddonFeature() check. |
| 362 | return f.UsesLimit() |
| 363 | }) |
| 364 | // FeatureSetPremium is just all features. |
| 365 | return premiumFeatures |
| 366 | } |
| 367 | // By default, return an empty set. |
| 368 | return []FeatureName{} |
| 369 | } |
| 370 | |
| 371 | type Feature struct { |
| 372 | Entitlement Entitlement `json:"entitlement"` |
nothing calls this directly
no test coverage detected