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

Method Weight

codersdk/deployment.go:48–59  ·  view source on GitHub ↗

Weight converts the enum types to a numerical value for easier comparisons. Easier than sets of if statements.

()

Source from the content-addressed store, hash-verified

46// Weight converts the enum types to a numerical value for easier
47// comparisons. Easier than sets of if statements.
48func (e Entitlement) Weight() int {
49 switch e {
50 case EntitlementEntitled:
51 return 2
52 case EntitlementGracePeriod:
53 return 1
54 case EntitlementNotEntitled:
55 return -1
56 default:
57 return -2
58 }
59}
60
61// Addon represents a grouping of features used for additional license SKUs.
62// It is complementary to FeatureSet and similar in implementation, allowing

Callers 1

CompareMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected