本文整理匯總了Golang中github.com/cgrates/cgrates/utils.RSRField.FilterPasses方法的典型用法代碼示例。如果您正苦於以下問題:Golang RSRField.FilterPasses方法的具體用法?Golang RSRField.FilterPasses怎麽用?Golang RSRField.FilterPasses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cgrates/cgrates/utils.RSRField
的用法示例。
在下文中一共展示了RSRField.FilterPasses方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: passesFieldFilter
// Follows the implementation in the StorCdr
func passesFieldFilter(m *diam.Message, fieldFilter *utils.RSRField) (bool, int) {
if fieldFilter == nil {
return true, 0
}
avps, err := avpsWithPath(m, fieldFilter)
if err != nil {
return false, 0
} else if len(avps) == 0 {
return false, 0 // No AVPs with field filter ID
}
for avpIdx, avpVal := range avps { // First match wins due to index
if fieldFilter.FilterPasses(avpValAsString(avpVal)) {
return true, avpIdx
}
}
return false, 0
}
示例2: passesFieldFilter
func passesFieldFilter(m *diam.Message, fieldFilter *utils.RSRField, processorVars map[string]string) (bool, int) {
if fieldFilter == nil {
return true, 0
}
if val, hasIt := processorVars[fieldFilter.Id]; hasIt { // ProcessorVars have priority
if fieldFilter.FilterPasses(val) {
return true, 0
}
return false, 0
}
avps, err := avpsWithPath(m, fieldFilter)
if err != nil {
return false, 0
}
if len(avps) == 0 { // No AVP found in request, treat it same as empty
if fieldFilter.FilterPasses("") {
return true, -1
}
}
for avpIdx, avpVal := range avps { // First match wins due to index
if fieldFilter.FilterPasses(avpValAsString(avpVal)) {
return true, avpIdx
}
}
return false, 0
}
示例3: passesFieldFilter
// Follows the implementation in the StorCdr
func (self *CCR) passesFieldFilter(fieldFilter *utils.RSRField) bool {
if fieldFilter == nil {
return true
}
return fieldFilter.FilterPasses(self.eventFieldValue(utils.RSRFields{fieldFilter}))
}