MCPcopy
hub / github.com/dgraph-io/dgraph / Compare

Method Compare

upgrade/upgrade.go:76–100  ·  view source on GitHub ↗

Compare compares v with other version, and tells if v is equal, less, or greater than other. It interprets nil as &version{major: 0, minor: 0, patch: 0}

(other *version)

Source from the content-addressed store, hash-verified

74// Compare compares v with other version, and tells if v is equal, less, or greater than other.
75// It interprets nil as &version{major: 0, minor: 0, patch: 0}
76func (v *version) Compare(other *version) versionComparisonResult {
77 if v == nil {
78 v = zeroVersion
79 }
80 if other == nil {
81 other = zeroVersion
82 }
83
84 switch {
85 case v.major > other.major:
86 return greater
87 case v.major < other.major:
88 return less
89 case v.minor > other.minor:
90 return greater
91 case v.minor < other.minor:
92 return less
93 case v.patch > other.patch:
94 return greater
95 case v.patch < other.patch:
96 return less
97 }
98
99 return equal
100}
101
102// change represents the action that needs to be taken during upgrade as a result of some breaking
103// change

Callers 13

runMethod · 0.80
NextMethod · 0.80
lessMethod · 0.80
lessFunction · 0.80
getIPsFromStringFunction · 0.80
isIpWhitelistedFunction · 0.80
VerifyPostingSplitsFunction · 0.80
getInequalityTokensFunction · 0.80
lessMethod · 0.80
RollupMethod · 0.80
TestVersion_CompareFunction · 0.80
validateAndParseInputFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestVersion_CompareFunction · 0.64