Packages

Cursor-based streaming of Ecto records that doesn't require database transaction.

Current section

6 Versions

Jump to

Compare versions

5 files changed
+10 additions
-10 deletions
  @@ -186,7 +186,7 @@
186 186 same "printed page" as the copyright notice for easier
187 187 identification within third-party archives.
188 188
189 - Copyright [yyyy] [name of copyright owner]
189 + Copyright [2023] [Jack Tomaszewski]
190 190
191 191 Licensed under the Apache License, Version 2.0 (the "License");
192 192 you may not use this file except in compliance with the License.
  @@ -1,6 +1,6 @@
1 1 # EctoCursorBasedStream
2 2
3 - [![Build Status](https://github.com/elixir-ecto/ecto/workflows/CI/badge.svg)](https://github.com/allegro/ecto-cursor-based-stream/actions) [![Hex.pm](https://img.shields.io/hexpm/v/ecto_cursor_based_stream.svg)](https://hex.pm/packages/ecto_cursor_based_stream) [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/ecto_cursor_based_stream/)
3 + ![Build Status](https://img.shields.io/github/actions/workflow/status/allegro/ecto-cursor-based-stream/test.yml) [![Hex.pm](https://img.shields.io/hexpm/v/ecto_cursor_based_stream.svg)](https://hex.pm/packages/ecto_cursor_based_stream) [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/ecto_cursor_based_stream/)
4 4
5 5 Cursor-based streaming of Ecto records, that does not require database transaction.
  @@ -18,4 +18,4 @@
18 18 {<<"optional">>,false},
19 19 {<<"repository">>,<<"hexpm">>},
20 20 {<<"requirement">>,<<"~> 3.0">>}]]}.
21 - {<<"version">>,<<"1.0.2">>}.
21 + {<<"version">>,<<"1.1.0">>}.
  @@ -15,6 +15,7 @@ defmodule EctoCursorBasedStream do
15 15 |> Stream.each(...)
16 16 |> Stream.run()
17 17 """
18 + import Ecto.Query
18 19
19 20 @type cursor_based_stream_opts :: [
20 21 {:max_rows, integer()}
  @@ -72,6 +73,7 @@ defmodule EctoCursorBasedStream do
72 73 end
73 74
74 75 @doc false
76 + @spec call(Ecto.Repo.t(), Ecto.Queryable.t(), cursor_based_stream_opts) :: Enumerable.t()
75 77 def call(repo, queryable, options \\ []) do
76 78 %{max_rows: max_rows, after_cursor: after_cursor, cursor_field: cursor_field} =
77 79 parse_options(options)
  @@ -102,8 +104,6 @@ defmodule EctoCursorBasedStream do
102 104 end
103 105
104 106 defp get_rows(repo, query, cursor_field, cursor, max_rows) do
105 - import Ecto.Query
106 -
107 107 query
108 108 |> order_by([o], asc: ^cursor_field)
109 109 |> then(fn query ->
  @@ -4,7 +4,7 @@ defmodule EctoCursorBasedStream.MixProject do
4 4 def project do
5 5 [
6 6 app: :ecto_cursor_based_stream,
7 - version: "1.0.2",
7 + version: "1.1.0",
8 8 elixir: "~> 1.13",
9 9 elixirc_paths: elixirc_paths(Mix.env()),
10 10 start_permanent: Mix.env() == :prod,
  @@ -40,10 +40,10 @@ defmodule EctoCursorBasedStream.MixProject do
40 40 defp deps do
41 41 [
42 42 {:ecto_sql, "~> 3.0"},
43 - {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
44 - {:credo, "~> 1.6", only: [:dev, :test], runtime: false},
45 - {:ex_doc, "~> 0.27", only: :dev, runtime: false},
46 - {:postgrex, "~> 0.16", only: [:test]}
43 + {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
44 + {:credo, "~> 1.7", only: [:dev, :test], runtime: false},
45 + {:ex_doc, "~> 0.32", only: :dev, runtime: false},
46 + {:postgrex, "~> 0.17", only: [:test]}
47 47 ]
48 48 end