Documentation
¶
Index ¶
Constants ¶
View Source
const FieldsSep = ":"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter interface {
// Key 条件字段
Key() string
// Fields 查询字段列表
// 根据条件字段对应的值不同,输出不同的字段
Fields(key string) []string
// FieldsCollection 字段集合
// 返回过滤器完整的字段列表
FieldsCollection() string
}
Filter 字段过滤工具
type FilterReader ¶
type FilterReader struct {
// Calibrate 数据校验
// 用于做数据对比与校准
Calibrate func(ip net.IP, data map[string]string) (ipNet *net.IPNet, ret map[string]string, updated bool)
// contains filtered or unexported fields
}
FilterReader 支持字段过滤的IP库读取器
func NewFilterReader ¶
NewFilterReader 初始化IP库读取器
func (*FilterReader) FieldsCollection ¶
func (r *FilterReader) FieldsCollection() string
FieldsCollection 字段集合
func (*FilterReader) LookupNetwork ¶
LookupNetwork 查询IP所在网段和对应数据
type KeyFieldsFilter ¶
type KeyFieldsFilter struct {
// contains filtered or unexported fields
}
KeyFieldsFilter 字段过滤工具
func NewKeyFieldsFilter ¶
func NewKeyFieldsFilter(arg string) *KeyFieldsFilter
NewKeyFieldsFilter 初始化字段过滤器 语法: <key>#<value1>:<filed1>,<field2>,<field3>|<value2>:<filed1>,<field2>,<field3>
- <key>: 用于匹配value的字段,默认为country
- <value>: 用于匹配fields的值,允许缺省,缺省时表示默认fields
- <filed>: 输出的字段内容
举例: country#中国:country,province,city,isp|country,-,-,isp
- 当country为中国时,输出country,province,city,isp;country为其他时,输出 country,-,-,isp (-表示缺省,不输出)
约束: 每组的字段数量需要保持一致
func (*KeyFieldsFilter) Fields ¶
func (f *KeyFieldsFilter) Fields(key string) []string
Fields 查询字段列表
func (*KeyFieldsFilter) FieldsCollection ¶
func (f *KeyFieldsFilter) FieldsCollection() string
FieldsCollection 字段集合
Click to show internal directories.
Click to hide internal directories.