MCPcopy Create free account
hub / github.com/devspace-sh/devspace / NewConstraint

Function NewConstraint

pkg/util/constraint/constraint.go:64–77  ·  view source on GitHub ↗

NewConstraint will parse one or more constraints from the given constraint string. The string must be a comma-separated list of constraints.

(v string)

Source from the content-addressed store, hash-verified

62// constraint string. The string must be a comma-separated list of
63// constraints.
64func NewConstraint(v string) (Constraints, error) {
65 vs := strings.Split(v, ",")
66 result := make([]*Constraint, len(vs))
67 for i, single := range vs {
68 c, err := parseSingle(single)
69 if err != nil {
70 return nil, err
71 }
72
73 result[i] = c
74 }
75
76 return result, nil
77}
78
79// Check tests if a version satisfies all the constraints.
80func (cs Constraints) Check(v *Version) bool {

Callers 6

ensureRequiresMethod · 0.92
TestNewConstraintFunction · 0.85
TestConstraintCheckFunction · 0.85
TestConstraintEqualFunction · 0.85
TestConstraint_sortFunction · 0.85
TestConstraintsStringFunction · 0.85

Calls 1

parseSingleFunction · 0.85

Tested by 5

TestNewConstraintFunction · 0.68
TestConstraintCheckFunction · 0.68
TestConstraintEqualFunction · 0.68
TestConstraint_sortFunction · 0.68
TestConstraintsStringFunction · 0.68