LoadFunctionMap loads an initial function map.
()
| 35 | |
| 36 | // LoadFunctionMap loads an initial function map. |
| 37 | func LoadFunctionMap() FunctionMap { |
| 38 | fm := &FunctionMap{} |
| 39 | fm.fns = &sync.Map{} |
| 40 | |
| 41 | fm.AddFunction("keyMatch", util.KeyMatchFunc) |
| 42 | fm.AddFunction("keyGet", util.KeyGetFunc) |
| 43 | fm.AddFunction("keyMatch2", util.KeyMatch2Func) |
| 44 | fm.AddFunction("keyGet2", util.KeyGet2Func) |
| 45 | fm.AddFunction("keyMatch3", util.KeyMatch3Func) |
| 46 | fm.AddFunction("keyGet3", util.KeyGet3Func) |
| 47 | fm.AddFunction("keyMatch4", util.KeyMatch4Func) |
| 48 | fm.AddFunction("keyMatch5", util.KeyMatch5Func) |
| 49 | fm.AddFunction("regexMatch", util.RegexMatchFunc) |
| 50 | fm.AddFunction("ipMatch", util.IPMatchFunc) |
| 51 | fm.AddFunction("globMatch", util.GlobMatchFunc) |
| 52 | |
| 53 | return *fm |
| 54 | } |
| 55 | |
| 56 | // GetFunctions return a map with all the functions. |
| 57 | func (fm *FunctionMap) GetFunctions() map[string]govaluate.ExpressionFunction { |
no test coverage detected
searching dependent graphs…