fix(resource): fix `query_mode/0` type and usage

This commit is contained in:
Thales Macedo Garitezi 2023-06-13 17:11:39 -03:00
parent a1690b3684
commit 7f850f7499
2 changed files with 4 additions and 6 deletions

View File

@ -22,7 +22,7 @@
-type resource_state() :: term().
-type resource_status() :: connected | disconnected | connecting | stopped.
-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 reply_fun() :: {fun((result(), Args :: term()) -> any()), Args :: term()} | undefined.
-type query_opts() :: #{

View File

@ -122,6 +122,7 @@
-export([apply_reply_fun/2]).
-export_type([
query_mode/0,
resource_id/0,
resource_data/0,
resource_status/0
@ -174,8 +175,7 @@
| {resource_status(), resource_state()}
| {resource_status(), resource_state(), term()}.
-callback query_mode(Config :: term()) ->
simple_sync | simple_async | sync | async | no_queries.
-callback query_mode(Config :: term()) -> query_mode().
-spec list_types() -> [module()].
list_types() ->
@ -413,9 +413,7 @@ call_stop(ResId, Mod, ResourceState) ->
Res
end).
-spec query_mode(module(), term(), creation_opts()) ->
simple_sync | simple_async | sync | async | no_queries.
-spec query_mode(module(), term(), creation_opts()) -> query_mode().
query_mode(Mod, Config, Opts) ->
case erlang:function_exported(Mod, query_mode, 1) of
true ->