code: func generalizedGroupBy(funcName string, entries interface{}, getValue func(interface{}) (interface{}, error), addEntry func(map[string][]interface{}, interface{}, interface{})) (map[string][]interface{}, error) {
  	entriesVal, err := getArrayValues(funcName, entries)
  
  	if err != nil {
  		return nil, err
  	}
  
  	groups := make(map[string][]interface{})
  	for i := 0; i < entriesVal.Len(); i++ {
  		v := reflect.Indirect(entriesVal.Index(i)).Interface()
  		value, err := getValue(v)
  		if err != nil {
  			return nil, err
  		}
  		if value != nil {
  			addEntry(groups, value, v)
  		}
  	}
  	return groups, nil
  }
docs: // Generalized groupBy function