Scrub creates an object that represents "callbacks" field in dnode message. The obj argument which will be scrubbed must be of array, slice, struct, or map type. If structure is passed, the returned callbacks map will contain its exported methods of func(*Partial) signature. Other functions must be
(obj interface{})
| 13 | // exported methods of func(*Partial) signature. Other functions must be |
| 14 | // wrapped by Callback function. |
| 15 | func (s *Scrubber) Scrub(obj interface{}) (callbacks map[string]Path) { |
| 16 | callbacks = make(map[string]Path) |
| 17 | rv := reflect.ValueOf(obj) |
| 18 | |
| 19 | k := rv.Kind() |
| 20 | if k != reflect.Array && k != reflect.Slice && k != reflect.Struct && k != reflect.Map { |
| 21 | return nil |
| 22 | } |
| 23 | |
| 24 | s.collect(rv, make(Path, 0), callbacks) |
| 25 | return callbacks |
| 26 | } |
| 27 | |
| 28 | var dnodeFunctionType = reflect.TypeOf(new(Function)).Elem() |
| 29 |