Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the input data for actions #27

Merged
merged 1 commit into from Apr 18, 2019

Conversation

@terry-xiaoyu
Copy link
Contributor

terry-xiaoyu commented Apr 18, 2019

Now the actions accept 2 args, the selected data and the envs:

-type(action_fun() :: fun((SelectedData::map(), Envs::map()) -> Result::any())).

-spec(inspect_action(Params :: map()) -> action_fun()).
inspect_action(Params) ->
    fun(Selected, Envs) ->
        io:format("[built_in:inspect_action]~n"
                  "\tSelected Data: ~p~n"
                  "\tEnvs: ~p~n"
                  "\tAction Init Params: ~p~n", [Selected, Envs, Params])
    end.

The selected data is the fields by applying the SQL SELECT onto the message/event.
The Env is the environment params including all fields of the original message event.

Now the actions accept 2 args, the `selected data` and the `envs`:

```erlang
-type(action_fun() :: fun((SelectedData::map(), Envs::map()) -> Result::any())).

-spec(inspect_action(Params :: map()) -> action_fun()).
inspect_action(Params) ->
    fun(Selected, Envs) ->
        io:format("[built_in:inspect_action]~n"
                  "\tSelected Data: ~p~n"
                  "\tEnvs: ~p~n"
                  "\tAction Init Params: ~p~n", [Selected, Envs, Params])
    end.
```

The selected data is the fields by applying the SQL SELECT onto the message/event.
The Env is the environment params including all fields of the original message event.
@terry-xiaoyu terry-xiaoyu merged commit 0d0968f into develop Apr 18, 2019
@terry-xiaoyu terry-xiaoyu deleted the improve_actions_input branch Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.