MCPcopy Index your code
hub / github.com/coder/coder / Features

Method Features

codersdk/deployment.go:341–369  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

339)
340
341func (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
371type Feature struct {
372 Entitlement Entitlement `json:"entitlement"`

Callers

nothing calls this directly

Calls 3

FeatureSetTypeAlias · 0.85
EnterpriseMethod · 0.80
UsesLimitMethod · 0.80

Tested by

no test coverage detected