本文整理汇总了Golang中github.com/AntoineAugusti/moduluschecking/models.SortCodeData.Weights方法的典型用法代码示例。如果您正苦于以下问题:Golang SortCodeData.Weights方法的具体用法?Golang SortCodeData.Weights怎么用?Golang SortCodeData.Weights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/AntoineAugusti/moduluschecking/models.SortCodeData
的用法示例。
在下文中一共展示了SortCodeData.Weights方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: IsValid
// Tell if the bank account is valid
func (e Exception2Checker) IsValid(b m.BankAccount, sc m.SortCodeData, attempt int) bool {
if !e.Handles(b, sc, attempt) {
panic("Should be exception of type 2")
}
sc.Weights = WeightsForException2Or9(b, sc)
return GeneralChecker{}.IsValid(b, sc, attempt)
}
示例2: IsValid
// Tell if the bank account is valid
func (e Exception10Checker) IsValid(b m.BankAccount, sc m.SortCodeData, attempt int) bool {
if !e.Handles(b, sc, attempt) {
panic("Should be exception of type 10")
}
// Put 8 zeros at the beginning of the weights
// and keep the original weights after
zeros := []int{0, 0, 0, 0, 0, 0, 0, 0}
sc.Weights = append(zeros, sc.Weights[8:]...)
return GeneralChecker{}.IsValid(b, sc, attempt)
}
示例3: IsValid
// Tell if the bank account is valid
func (e Exception9Checker) IsValid(b m.BankAccount, sc m.SortCodeData, attempt int) bool {
if !e.Handles(b, sc, attempt) {
panic("Should be exception of type 9")
}
sc.Weights = WeightsForException2Or9(b, sc)
if (GeneralChecker{}.IsValid(b, sc, attempt)) {
return true
}
// Try to replace the sort code
b.SortCode = "309634"
return GeneralChecker{}.IsValid(b, e.Weights[b.SortCode], attempt)
}