Skip to content

Commit

Permalink
[AUTO] [ RTI-14085 ] Update Dependencies (#86)
Browse files Browse the repository at this point in the history
* Update dependencies

* [update-deps] Thank you, Elvis!

---------

Co-authored-by: Brujo Benavides Rodriguez <[email protected]>
  • Loading branch information
adroll-rtb-ci and elbrujohalcon authored Mar 6, 2023
1 parent a24d6f9 commit 1645182
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 54 deletions.
37 changes: 0 additions & 37 deletions include/dinerl_types.hrl

This file was deleted.

2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{project_plugins,
[{rebar3_hex, "~> 7.0.4"},
{rebar3_format, "~> 1.2.1"},
{rebar3_lint, "~> 2.0.1"},
{rebar3_lint, "~> 3.0.0"},
{rebar3_hank, "~> 1.3.0"}]}.

{dialyzer,
Expand Down
33 changes: 32 additions & 1 deletion src/dinerl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,38 @@
-define(ALL_NEW, <<"ALL_NEW">>).
-define(UPDATED_NEW, <<"UPDATED_NEW">>).

-include("dinerl_types.hrl").
-type access_key_id() :: string().
-type secret_access_key() :: string().
-type zone() :: string().
-type rfcdate() :: string().
-type field() :: {binary(), binary() | string()}.
-type keyschema_element() :: {binary(), [field()]}.
-type keyschema() :: [keyschema_element()].
-type jsonf() :: any().
-type clientarguments() :: {{access_key_id(), secret_access_key()}, zone(), rfcdate()}.
-type method() ::
batch_get_item |
get_item |
put_item |
delete_item |
update_item |
create_table |
list_tables |
describe_table |
update_table |
delete_table |
q |
scan |
query_item_20111205 |
query_item_20120810.
-type result() ::
{ok, any()} |
{error, string(), string()} |
{error, term(), timeout | string()} |
{error, atom(), any()}.

-export_type([access_key_id/0, clientarguments/0, jsonf/0, keyschema/0, method/0,
result/0, secret_access_key/0, zone/0]).

-export([setup/3, setup/1, setup/0, api/1, api/2, api/3, api/4]).
-export([create_table/4, create_table/5, delete_table/1, delete_table/2]).
Expand Down
12 changes: 5 additions & 7 deletions src/dinerl_client.erl
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
-module(dinerl_client).

-include("dinerl_types.hrl").

-export([api/5, api/6]).

%%
%% Item related operations
%%
-spec method_name(method()) -> string().
-spec method_name(dinerl:method()) -> string().
method_name(batch_get_item) ->
"DynamoDB_20111205.BatchGetItem";
method_name(batch_write_item) ->
Expand Down Expand Up @@ -44,12 +42,12 @@ method_name(scan) ->
"DynamoDB_20111205.Scan".

-spec api(awsv4:credentials(),
zone(),
aws_datetime(),
method(),
dinerl:zone(),
dynamodb:aws_datetime(),
dinerl:method(),
any(),
undefined | integer()) ->
result().
dinerl:result().
api(Credentials, Zone, ISODate, Name, Body, Timeout) ->
case dynamodb:call(Credentials,
Zone,
Expand Down
11 changes: 9 additions & 2 deletions src/dmochijson2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
-export([encoder/1, encode/1]).
-export([decoder/1, decode/1, decode/2]).

%% It was the style used by mochiweb
-elvis([{elvis_style, param_pattern_matching, #{side => left}}]).

%% This is a macro to placate syntax highlighters..
-define(Q, $\").
-define(ADV_COL(S, N),
Expand Down Expand Up @@ -73,6 +76,8 @@
json_eep18_object() |
json_iodata().

-export_type([json_term/0]).

-record(encoder, {handler = null, utf8 = false}).
-record(decoder, {object_hook = null, offset = 0, line = 1, column = 1, state = null}).

Expand Down Expand Up @@ -138,7 +143,7 @@ json_encode(F, _State) when is_float(F) ->
dmochinum:digits(F);
json_encode(S, State) when is_binary(S); is_atom(S) ->
json_encode_string(S, State);
json_encode([{K, _} | _] = Props, State)
json_encode(Props = [{K, _} | _], State)
when K =/= struct andalso K =/= array andalso K =/= json ->
json_encode_proplist(Props, State);
json_encode({struct, Props}, State) when is_list(Props) ->
Expand Down Expand Up @@ -529,7 +534,9 @@ tokenize_number(B, esign, S = #decoder{offset = O}, Acc) ->
tokenize_number(B, eint, S = #decoder{offset = O}, Acc) ->
case B of
<<_:O/binary, C, _/binary>> when C >= $0 andalso C =< $9 ->
tokenize_number(B, eint1, ?INC_COL(S), [C | Acc])
tokenize_number(B, eint1, ?INC_COL(S), [C | Acc]);
_ ->
exit({invalid_eint, B})
end;
tokenize_number(B, eint1, S = #decoder{offset = O}, Acc) ->
case B of
Expand Down
17 changes: 11 additions & 6 deletions src/dynamodb.erl
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
-module(dynamodb).

-include("dinerl_types.hrl").
-type aws_datetime() :: string().
-type endpoint() :: string().
-type header() :: {string() | atom(), string()}.
-type headers() :: [header()].

-export_type([aws_datetime/0]).

-export([call/5, call/6]).

%% @todo Remove when lhttpc's specs are fixed
-dialyzer({nowarn_function, [call/6, submit/4]}).

-spec endpoint(zone()) -> endpoint().
-spec endpoint(dinerl:zone()) -> endpoint().
endpoint("us-east-1" ++ _R) ->
"dynamodb.us-east-1.amazonaws.com";
endpoint("us-west-1" ++ _R) ->
Expand All @@ -21,7 +26,7 @@ endpoint("ap-southeast-1" ++ _R) ->
endpoint("eu-west-1" ++ _R) ->
"dynamodb.eu-west-1.amazonaws.com".

-spec region(zone()) -> string().
-spec region(dinerl:zone()) -> string().
region("us-east-1" ++ _R) ->
"us-east-1";
region("us-west-1" ++ _R) ->
Expand All @@ -36,12 +41,12 @@ region("eu-west-1" ++ _R) ->
"eu-west-1".

-spec call(awsv4:credentials(),
zone(),
dinerl:zone(),
string(),
aws_datetime(),
iodata(),
undefined | pos_integer()) ->
result().
dinerl:result().
call(Credentials, Zone, Target, ISODate, Body, undefined) ->
call(Credentials, Zone, Target, ISODate, Body, 1000);
call(Credentials, Zone, Target, ISODate, Body, Timeout) ->
Expand All @@ -60,7 +65,7 @@ call(Credentials, Zone, Target, ISODate, Body, Timeout) ->
call(Credentials, Zone, Target, RFCDate, Body) ->
call(Credentials, Zone, Target, RFCDate, Body, 1000).

-spec submit(endpoint(), headers(), iodata(), integer()) -> result().
-spec submit(endpoint(), headers(), iodata(), integer()) -> dinerl:result().
submit(Host, Headers, Body, Timeout) when is_list(Host) ->
MaxConnections = dinerl_util:get_env(max_connections),
Opts = [{max_connections, MaxConnections}],
Expand Down

0 comments on commit 1645182

Please sign in to comment.