fix(resource): fix `query_mode/0` type and usage
This commit is contained in:
parent
a1690b3684
commit
7f850f7499
|
@ -22,7 +22,7 @@
|
||||||
-type resource_state() :: term().
|
-type resource_state() :: term().
|
||||||
-type resource_status() :: connected | disconnected | connecting | stopped.
|
-type resource_status() :: connected | disconnected | connecting | stopped.
|
||||||
-type callback_mode() :: always_sync | async_if_possible.
|
-type callback_mode() :: always_sync | async_if_possible.
|
||||||
-type query_mode() :: async | sync | simple_async | simple_sync | dynamic.
|
-type query_mode() :: simple_sync | simple_async | sync | async | no_queries.
|
||||||
-type result() :: term().
|
-type result() :: term().
|
||||||
-type reply_fun() :: {fun((result(), Args :: term()) -> any()), Args :: term()} | undefined.
|
-type reply_fun() :: {fun((result(), Args :: term()) -> any()), Args :: term()} | undefined.
|
||||||
-type query_opts() :: #{
|
-type query_opts() :: #{
|
||||||
|
|
|
@ -122,6 +122,7 @@
|
||||||
-export([apply_reply_fun/2]).
|
-export([apply_reply_fun/2]).
|
||||||
|
|
||||||
-export_type([
|
-export_type([
|
||||||
|
query_mode/0,
|
||||||
resource_id/0,
|
resource_id/0,
|
||||||
resource_data/0,
|
resource_data/0,
|
||||||
resource_status/0
|
resource_status/0
|
||||||
|
@ -174,8 +175,7 @@
|
||||||
| {resource_status(), resource_state()}
|
| {resource_status(), resource_state()}
|
||||||
| {resource_status(), resource_state(), term()}.
|
| {resource_status(), resource_state(), term()}.
|
||||||
|
|
||||||
-callback query_mode(Config :: term()) ->
|
-callback query_mode(Config :: term()) -> query_mode().
|
||||||
simple_sync | simple_async | sync | async | no_queries.
|
|
||||||
|
|
||||||
-spec list_types() -> [module()].
|
-spec list_types() -> [module()].
|
||||||
list_types() ->
|
list_types() ->
|
||||||
|
@ -413,9 +413,7 @@ call_stop(ResId, Mod, ResourceState) ->
|
||||||
Res
|
Res
|
||||||
end).
|
end).
|
||||||
|
|
||||||
-spec query_mode(module(), term(), creation_opts()) ->
|
-spec query_mode(module(), term(), creation_opts()) -> query_mode().
|
||||||
simple_sync | simple_async | sync | async | no_queries.
|
|
||||||
|
|
||||||
query_mode(Mod, Config, Opts) ->
|
query_mode(Mod, Config, Opts) ->
|
||||||
case erlang:function_exported(Mod, query_mode, 1) of
|
case erlang:function_exported(Mod, query_mode, 1) of
|
||||||
true ->
|
true ->
|
||||||
|
|
Loading…
Reference in New Issue