changed CHANGELOG.md
 
@@ -5,6 5,11 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
## v1.2.0 - 2022-10-27
9
* Make config raise specific domain specific error ([#176](https://github.com/duffelhq/paginator/pull/176))
10
* Update package dependencies
11
* `ex_doc` 0.28.2
12
8
13
## v1.1.0 - 2022-02-08
9
14
10
15
* Skip duplicated GitHub Actions runs: ([#110](https://github.com/duffelhq/paginator/pull/110), thanks! @dolfinus)
changed README.md
 
@@ -69,7 69,7 @@ Add `:paginator` to your list of dependencies in `mix.exs`:
69
69
```elixir
70
70
def deps do
71
71
[
72
- {:paginator, "~> 1.1.0"}
72
{:paginator, "~> 1.2.0"}
73
73
]
74
74
end
75
75
```
changed hex_metadata.config
 
@@ -41,4 41,4 @@
41
41
{<<"optional">>,false},
42
42
{<<"repository">>,<<"hexpm">>},
43
43
{<<"requirement">>,<<"~> 1.2.0">>}]]}.
44
- {<<"version">>,<<"1.1.0">>}.
44
{<<"version">>,<<"1.2.0">>}.
changed lib/paginator.ex
 
@@ -207,7 207,11 @@ defmodule Paginator do
207
207
iex> Paginator.cursor_for_record(%Paginator.Customer{id: 1, name: "Alice"}, [id: :asc, name: :desc])
208
208
"g3QAAAACZAACaWRhAWQABG5hbWVtAAAABUFsaWNl"
209
209
"""
210
- @spec cursor_for_record(any(), [atom() | {atom(), atom()}], (map(), atom() | {atom(), atom()} -> any())) :: binary()
210
@spec cursor_for_record(
211
any(),
212
[atom() | {atom(), atom()}],
213
(map(), atom() | {atom(), atom()} -> any())
214
) :: binary()
211
215
def cursor_for_record(
212
216
record,
213
217
cursor_fields,
changed lib/paginator/config.ex
 
@@ -20,6 20,10 @@ defmodule Paginator.Config do
20
20
:total_count_limit
21
21
]
22
22
23
defmodule ArgumentError do
24
defexception [:message]
25
end
26
23
27
@default_total_count_primary_key_field :id
24
28
@default_limit 50
25
29
@minimum_limit 1
 
@@ -55,15 59,19 @@ defmodule Paginator.Config do
55
59
56
60
def validate!(%__MODULE__{} = config) do
57
61
unless config.cursor_fields do
58
- raise(ArgumentError, "expected `:cursor_fields` to be set")
62
raise(Paginator.Config.ArgumentError, message: "expected `:cursor_fields` to be set")
59
63
end
60
64
61
65
if !cursor_values_match_cursor_fields?(config.after_values, config.cursor_fields) do
62
- raise(ArgumentError, message: "expected `:after` cursor to match `:cursor_fields`")
66
raise(Paginator.Config.ArgumentError,
67
message: "expected `:after` cursor to match `:cursor_fields`"
68
)
63
69
end
64
70
65
71
if !cursor_values_match_cursor_fields?(config.before_values, config.cursor_fields) do
66
- raise(ArgumentError, message: "expected `:before` cursor to match `:cursor_fields`")
72
raise(Paginator.Config.ArgumentError,
73
message: "expected `:before` cursor to match `:cursor_fields`"
74
)
67
75
end
68
76
end
changed mix.exs
 
@@ -2,7 2,7 @@ defmodule Paginator.Mixfile do
2
2
use Mix.Project
3
3
4
4
@source_url "https://github.com/duffelhq/paginator"
5
- @version "1.1.0"
5
@version "1.2.0"
6
6
7
7
def project do
8
8
[