1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-01 23:16:22 +00:00

vendor change

This commit is contained in:
kinarashah
2019-06-27 14:50:54 -07:00
committed by Alena Prokharchyk
parent 9697b3c452
commit 8c8e3d1c6b
126 changed files with 14464 additions and 341 deletions

49
vendor/github.com/mcuadros/go-version/constraint.go generated vendored Normal file
View File

@@ -0,0 +1,49 @@
package version
import (
"strings"
)
type Constraint struct {
operator string
version string
}
// Return a new Constrain and sets operator and version to compare
func NewConstrain(operator, version string) *Constraint {
constraint := new(Constraint)
constraint.SetOperator(operator)
constraint.SetVersion(version)
return constraint
}
// Sets operator to compare
func (self *Constraint) SetOperator(operator string) {
self.operator = operator
}
// Get operator to compare
func (self *Constraint) GetOperator() string {
return self.operator
}
// Sets version to compare
func (self *Constraint) SetVersion(version string) {
self.version = version
}
// Get version to compare
func (self *Constraint) GetVersion() string {
return self.version
}
// Match a given version againts the constraint
func (self *Constraint) Match(version string) bool {
return Compare(version, self.version, self.operator)
}
// Return a string representation
func (self *Constraint) String() string {
return strings.Trim(self.operator+" "+self.version, " ")
}