本文整理匯總了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)
}