Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{erl_opts, [
debug_info,
warnings_as_errors
warnings_as_errors,
{platform_define, "17|18", 'OLD_GEN_FSM'}
]}.

{deps, [
neotoma,
{sqlparser, "0.2.0"}
]}.

Expand All @@ -14,12 +14,7 @@
{plugins, [
{rebar_edown_plugin,
{git, "git://github.com/altenwald/rebar_edown_plugin.git", {branch, "master"}}
},
rebar3_neotoma_plugin
]}.

{provider_hooks, [
{pre, [{compile, {neotoma, compile}}]}
}
]}.

{edoc_opts,[
Expand Down
2 changes: 1 addition & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{"1.1.0",
[{<<"neotoma">>,{pkg,<<"neotoma">>,<<"1.7.3">>},0},
[{<<"neotoma">>,{pkg,<<"neotoma">>,<<"1.7.3">>},1},
{<<"sqlparser">>,{pkg,<<"sqlparser">>,<<"0.2.0">>},0}]}.
[
{pkg_hash,[
Expand Down
10 changes: 8 additions & 2 deletions src/my_request.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
-module(my_request).
-author('Manuel Rubio <manuel@altenwald.com>').

-behaviour(gen_fsm).
-ifdef(OLD_GEN_FSM).
-define(GEN_FSM, gen_fsm).
-else.
-define(GEN_FSM, gen_statem).
-endif.

-behaviour(?GEN_FSM).

-define(SERVER, ?MODULE).

Expand Down Expand Up @@ -46,7 +52,7 @@
ParseQuery :: boolean()) -> {ok, pid()}.

start(Socket, Id, Handler, ParseQuery) ->
{ok, Pid} = gen_fsm:start(?MODULE, [Socket, Id, Handler, ParseQuery], []),
{ok, Pid} = ?GEN_FSM:start(?MODULE, [Socket, Id, Handler, ParseQuery], []),
gen_tcp:controlling_process(Socket, Pid),
inet:setopts(Socket, [{active, true}]),
{ok, Pid}.
Expand Down