func FlatMapFunc(f interface{}) (operators.UnFunc, error) {
	fntype := reflect.TypeOf(f)

	funcForm, err := isUnaryFuncForm(fntype)
	if err != nil {
		return nil, err
	}
	if funcForm == unaryFuncUnsupported {
		return nil, fmt.Errorf("unsupported unary func type")
	}

	if fntype.Out(0).Kind() != reflect.Slice {
		return nil, fmt.Errorf("unary FlatMap func must return slice")
	}

	fnval := reflect.ValueOf(f)
	return operators.UnFunc(func(ctx api.StreamContext, data interface{}) interface{} {
		result := callOpFunc(fnval, ctx, data, funcForm)
		return result.Interface()
	}), nil
}
// FlatMapFunc returns an unary function which applies a user-defined function which
// takes incoming comsite items and deconstruct them into individual items which can
// then be re-streamed.  The type for the user-defined function is:
//   func (T) R - where R is the original item, R is a slice of decostructed items
// The slice returned should be restreamed by placing each item onto the stream for
// downstream processing.
FlatMapFunc returns an unary function which applies a user-defined function which
takes incoming comsite items and deconstruct them into individual items which can
then be re-streamed.  The type for the user-defined function is:
func (T) R - where R is the original item, R is a slice of decostructed items
The slice returned should be restreamed by placing each item onto the stream for
downstream processing.
// FlatMapFunc returns an unary function which applies a user - defined function which // takes incoming comsite items and deconstruct them into individual items which can // then be re - streamed . The type for the user - defined function is : // func ( T ) R - where R is the original item R is a slice of decostructed items // The slice returned should be restreamed by placing each item onto the stream for // downstream processing .
func FlatMapFunc(f interface{}) (operators.UnFunc, error) {
	fntype := reflect.TypeOf(f)
	funcForm, err := isUnaryFuncForm(fntype)
	if err != nil {
		return nil, err
	}
	if funcForm == unaryFuncUnsupported {
		return nil, fmt.Errorf("unsupported unary func type")
	}
	if fntype.Out(0).Kind() != reflect.Slice {
		return nil, fmt.Errorf("unary FlatMap func must return slice")
	}
	fnval := reflect.ValueOf(f)
	return operators.UnFunc(func(ctx api.StreamContext, data interface{}) interface{} {
		result := callOpFunc(fnval, ctx, data, funcForm)
		return result.Interface()
	}), nil
}
func FlatMapFunc ( f interface { } ) ( operators . UnFunc , error ) { fntype := reflect . TypeOf ( f ) funcForm , err := isUnaryFuncForm ( fntype ) if err != nil { return nil , err } if funcForm == unaryFuncUnsupported { return nil , fmt . Errorf ( " " ) } if fntype . Out ( 0 ) . Kind ( ) != reflect . Slice { return nil , fmt . Errorf ( " " ) } fnval := reflect . ValueOf ( f ) return operators . UnFunc ( func ( ctx api . StreamContext , data interface { } ) interface { } { result := callOpFunc ( fnval , ctx , data , funcForm ) return result . Interface ( ) } ) , nil }
FlatMapFunc returns an unary function which applies a user-defined function which
takes incoming comsite items and deconstruct them into individual items which can
then be re-streamed.
FlatMapFunc returns an unary function which applies a user - defined function which takes incoming comsite items and deconstruct them into individual items which can then be re - streamed .