Callback creates mapping that will call mapper() function for each directive with the specified name. No further processing is done. Directives with the specified name will not be returned by Process if AllowUnknown is used. It is intended to permit multiple independent values of directive with im
(name string, mapper func(*Map, Node) error)
| 629 | // It is intended to permit multiple independent values of directive with |
| 630 | // implementation-defined handling. |
| 631 | func (m *Map) Callback(name string, mapper func(*Map, Node) error) { |
| 632 | if m.entries == nil { |
| 633 | m.entries = make(map[string]matcher) |
| 634 | } |
| 635 | if _, ok := m.entries[name]; ok { |
| 636 | panic("Map.Custom: duplicate matcher") |
| 637 | } |
| 638 | |
| 639 | m.entries[name] = matcher{ |
| 640 | name: name, |
| 641 | customCallback: mapper, |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | // Process maps variables from global configuration and block passed in NewMap. |
| 646 | // |
no outgoing calls