本文整理汇总了Golang中github.com/wallyworld/core/version.Number.Compare方法的典型用法代码示例。如果您正苦于以下问题:Golang Number.Compare方法的具体用法?Golang Number.Compare怎么用?Golang Number.Compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/wallyworld/core/version.Number
的用法示例。
在下文中一共展示了Number.Compare方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestUpgradeOperationsOrdered
func (s *upgradeSuite) TestUpgradeOperationsOrdered(c *gc.C) {
var previous version.Number
for i, utv := range (*upgrades.UpgradeOperations)() {
vers := utv.TargetVersion()
if i > 0 {
c.Check(previous.Compare(vers), gc.Equals, -1)
}
previous = vers
}
}
示例2: Newest
// Newest returns the greatest version in src, and the tools with that version.
func (src List) Newest() (version.Number, List) {
var result List
var best version.Number
for _, tools := range src {
if best.Compare(tools.Version.Number) < 0 {
// Found new best number; reset result list.
best = tools.Version.Number
result = append(result[:0], tools)
} else if tools.Version.Number == best {
result = append(result, tools)
}
}
return best, result
}
示例3: isPreHAVersion
func isPreHAVersion(v version.Number) bool {
return v.Compare(version.MustParse("1.19.0")) < 0
}
示例4: isCompatibleVersion
func isCompatibleVersion(v1, v2 version.Number) bool {
v1.Build = 0
v2.Build = 0
return v1.Compare(v2) == 0
}