Skip to content

Commit 768e9ec

Browse files
authored
Add on-push workflow (#25)
* Add github on-push workflow, * Documentation cleanup
1 parent e787070 commit 768e9ec

File tree

6 files changed

+58
-36
lines changed

6 files changed

+58
-36
lines changed

.github/workflows/on-push.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: on-push
2+
on: [push]
3+
env:
4+
MIX_ENV: test
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: erlef/setup-elixir@v1
11+
with:
12+
otp-version: '23.0.4'
13+
elixir-version: '1.10.4'
14+
- uses: rrainn/[email protected]
15+
- run: mix deps.get
16+
- run: mix compile
17+
- run: mix format --check-formatted
18+
- run: mix test

lib/ex_aws/dynamo.ex

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
defmodule ExAws.Dynamo do
22
@moduledoc """
3-
Operations on the AWS Dynamo service.
3+
Operations on the AWS DynamoDB service.
44
5-
NOTE: When Mix.env in [:test, :dev] dynamo clients will run by default against
5+
NOTE: When Mix.env in [:test, :dev], Dynamo clients will run by default against
66
DynamoDB local.
77
88
## Basic usage
@@ -33,31 +33,31 @@ defmodule ExAws.Dynamo do
3333
3434
## General notes
3535
All options are handled as underscored atoms instead of camelcased binaries as specified
36-
in the Dynamo API. IE `IndexName` would be `:index_name`. Anywhere in the API that requires
37-
dynamo type annotation (`{"S":"mystring"}`) is handled for you automatically. IE
36+
in the Dynamo API, e.g. `IndexName` would be `:index_name`. Anywhere in the API that requires
37+
Dynamo type annotation (`{"S":"mystring"}`) is handled for you automatically. For example,
3838
3939
```elixir
4040
ExAws.Dynamo.scan("Users", expression_attribute_values: [api_key: "foo"])
4141
```
42-
Transforms into a query of
42+
transforms into a query of
4343
```elixir
4444
%{"ExpressionAttributeValues" => %{api_key: %{"S" => "foo"}}, "TableName" => "Users"}
4545
```
4646
4747
Consult the function documentation to see precisely which options are handled this way.
4848
49-
If you wish to avoid this kind of automatic behaviour you are free to specify the types yourself.
50-
IE:
49+
If you wish to avoid this kind of automatic behaviour, you are free to specify the types yourself.
50+
For example,
5151
```elixir
5252
ExAws.Dynamo.scan("Users", expression_attribute_values: [api_key: %{"B" => "Treated as binary"}])
5353
```
54-
Becomes:
54+
becomes
5555
```elixir
5656
%{"ExpressionAttributeValues" => %{api_key: %{"B" => "Treated as binary"}}, "TableName" => "Users"}
5757
```
5858
Alternatively, if what's being encoded is a struct, you're always free to implement ExAws.Dynamo.Encodable for that struct.
5959
60-
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations.html
60+
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations.html
6161
"""
6262

6363
import ExAws.Utils, only: [camelize: 1, camelize_keys: 1, camelize_keys: 2, upcase: 1]
@@ -150,9 +150,11 @@ defmodule ExAws.Dynamo do
150150
@doc """
151151
Create table
152152
153-
`key_schema` can be a simple binary or atom indicating a simple hash key
153+
`key_schema` can be a simple binary or atom indicating a simple hash key.
154154
155-
`billing_mode` may be either `:provisioned` (default) or `:pay_per_request`. If you are creating a `:pay-per-request` table, you will still need to provide values for read and write capacities, although they will be ignored - you may consider providing `nil` in those cases.
155+
`billing_mode` may be either `:provisioned` (default) or `:pay_per_request`.
156+
If you are creating a `:pay-per-request` table, you will still need to provide values for read and write capacities,
157+
although they will be ignored - you may consider providing `nil` in those cases.
156158
"""
157159
@spec create_table(
158160
table_name :: binary,
@@ -214,14 +216,16 @@ defmodule ExAws.Dynamo do
214216
@doc """
215217
Create table with secondary indices
216218
217-
Each index should follow the format outlined here: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html
219+
Each index should follow the format outlined here: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html
218220
219-
For convenience, the keys in each index map are allowed to be atoms. IE:
221+
For convenience, the keys in each index map are allowed to be atoms. e.g:
220222
`"KeySchema"` in the aws docs can be `key_schema:`
221223
222224
Note that both the `global_indexes` and `local_indexes` arguments expect a list of such indices.
223225
224-
`billing_mode` may be either `:provisioned` (default) or `:pay_per_request`. If you are creating a `:pay-per-request` table, you will still need to provide values for read and write capacities, although they will be ignored - you may consider providing `nil` in those cases.
226+
`billing_mode` may be either `:provisioned` (default) or `:pay_per_request`.
227+
If you are creating a `:pay-per-request` table, you will still need to provide values for read and write capacities,
228+
although they will be ignored - you may consider providing `nil` in those cases.
225229
226230
Examples
227231
```
@@ -402,7 +406,7 @@ defmodule ExAws.Dynamo do
402406
@doc """
403407
Scan table
404408
405-
Please read http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
409+
Please read https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
406410
407411
```
408412
Dynamo.scan("Users"
@@ -412,11 +416,11 @@ defmodule ExAws.Dynamo do
412416
filter_expression: "#asdf = :desired_api_key")
413417
```
414418
415-
Generally speaking you won't need to use `:expression_attribute_names`. It exists
416-
to alias a column name if one of the columns you want to search against is a reserved dynamo word,
417-
like `Percentile`. In this case it's totally unnecessary as `api_key` is not a reserved word.
419+
Generally speaking, you won't need to use `:expression_attribute_names`. It exists
420+
to alias a column name if one of the columns you want to search against is a reserved Dynamo word,
421+
like `Percentile`. In this case, it's totally unnecessary as `api_key` is not a reserved word.
418422
419-
Parameters with keys that are automatically annotated with dynamo types are:
423+
Parameters with keys that are automatically annotated with Dynamo types are:
420424
`[:exclusive_start_key, :expression_attribute_names]`
421425
"""
422426
@type scan_opts :: [
@@ -446,7 +450,7 @@ defmodule ExAws.Dynamo do
446450
@doc """
447451
Query Table
448452
449-
Please read: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
453+
Please read https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
450454
451455
```
452456
Dynamo.query("Users",
@@ -484,10 +488,10 @@ defmodule ExAws.Dynamo do
484488
end
485489

486490
@doc """
487-
Get up to 100 items (16mb)
491+
Batch-get up to 100 items (16 MB total max)
488492
489493
Map of table names to request parameter maps.
490-
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html
494+
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html
491495
492496
Parameters with keys that are automatically annotated with dynamo types are:
493497
`[:keys]`
@@ -510,7 +514,7 @@ defmodule ExAws.Dynamo do
510514
}
511515
})
512516
```
513-
As you see you're largely free to use either keyword args or maps in the body. A map
517+
As you see, you're largely free to use either keyword args or maps in the body. A map
514518
is required for the argument itself because the table names are most often binaries, and I refuse
515519
to inflict proplists on anyone.
516520
@@ -582,12 +586,12 @@ defmodule ExAws.Dynamo do
582586
end
583587

584588
@doc """
585-
Put or delete up to 25 items (16mb)
589+
Put or delete up to 25 items (16 MB total max)
586590
587591
Map of table names to request parameter maps.
588-
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
592+
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
589593
590-
Parameters with keys that are automatically annotated with dynamo types are:
594+
Parameters with keys that are automatically annotated with Dynamo types are:
591595
`[:keys]`
592596
"""
593597
@type write_item :: [
@@ -652,7 +656,7 @@ defmodule ExAws.Dynamo do
652656
Update item in table
653657
654658
For update_args format see
655-
http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
659+
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
656660
"""
657661
@type update_item_opts :: [
658662
{:condition_expression, binary}
@@ -862,7 +866,7 @@ defmodule ExAws.Dynamo do
862866
defp build_expression_attribute_values(data, _), do: data
863867

864868
## Various other helpers
865-
################
869+
#########################
866870

867871
defp add_upcased_opt(data, opts, key) do
868872
case Map.fetch(opts, key) do

lib/ex_aws/dynamo/decoder.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
defmodule ExAws.Dynamo.Decoder do
22
@moduledoc """
3-
Decodes a dynamo response into a struct.
3+
Decodes a Dynamo response into a struct.
44
5-
If Dynamo.Decodable is implemented for the struct it will be called
5+
If Dynamo.Decodable is implemented for the struct, it will be called
66
after the completion of the coercion.
77
88
This is important for handling nested maps if you wanted the nested maps

lib/ex_aws/dynamo/encodable.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defprotocol ExAws.Dynamo.Encodable do
22
@type t :: any
33

4-
@doc "Converts an elixir value into a map tagging the value with its dynamodb type"
4+
@doc "Converts an Elixir value into a map tagging the value with its Dynamo type"
55
def encode(value, options)
66
end
77

@@ -104,7 +104,7 @@ defimpl ExAws.Dynamo.Encodable, for: List do
104104
def encode([], _), do: %{"L" => []}
105105

106106
@doc """
107-
Dynamodb offers typed sets and L, a generic list of typed attributes.
107+
DynamoDB offers typed sets and L, a generic list of typed attributes.
108108
"""
109109
def encode(list, _) do
110110
typed_values =

lib/ex_aws/dynamo/encoder.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmodule ExAws.Dynamo.Encoder do
22
@moduledoc """
3-
Takes an elixir value and converts it into a dynamo style map.
3+
Takes an Elixir value and converts it into a Dynamo-style map.
44
55
```elixir
66
MapSet.new [1,2,3] |> #{__MODULE__}.encode
@@ -33,8 +33,8 @@ defmodule ExAws.Dynamo.Encoder do
3333
ExAws.Dynamo.Encodable.encode(value, options)
3434
end
3535

36-
# Use this in case you want to encode something already in dynamo format
37-
# For some reason I cannot fathom. If you find yourself using this, please open an issue
36+
# Use this in case you want to encode something already in Dynamo format
37+
# for some reason I cannot fathom. If you find yourself using this, please open an issue
3838
# so I can find out why and better support this.
3939
def encode!(value, options \\ []) do
4040
ExAws.Dynamo.Encodable.encode(value, options)

lib/ex_aws/dynamo/lazy.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule ExAws.Dynamo.Lazy do
22
@moduledoc false
33

4-
## Implimentation of the lazy functions surfaced by ExAws.Dynamo.Client
4+
## Implementation of the lazy functions surfaced by ExAws.Dynamo.Client
55

66
@doc "Generates a scan stream"
77
def stream_scan(table, opts, config) do

0 commit comments

Comments
 (0)