Skip to content

Commit c5f7c31

Browse files
committed
Merge branch 'update-version-of-hlclock'
2 parents 1937881 + 0f86965 commit c5f7c31

7 files changed

Lines changed: 31 additions & 31 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ecto.HLClock
1+
# EctoHLClock
22

33
Provides the necessary [Ecto](https://github.com/elixir-ecto/ecto) type
44
information for [hybrid logical clocks](https://github.com/tonic-sys/hlclock).
@@ -27,7 +27,7 @@ alter table (:your_table) do
2727
add :hlc_column, :binary, null: false
2828
end
2929

30-
Ecto.HLClock.Migration.create_hlc_constraint(:your_table, :hlc_column)
30+
EctoHLClock.Migration.create_hlc_constraint(:your_table, :hlc_column)
3131
```
3232

3333
`create_hlc_constraint`, by design, creates a deterministic naming convention
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Ecto.HLClock do
1+
defmodule EctoHLClock do
22
@moduledoc """
33
Provides capability for storing HLC's in the database
44
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Ecto.HLClock.Migration do
1+
defmodule EctoHLClock.Migration do
22
@moduledoc """
33
Ecto migration helper for adding constraints to the HLC `:binary` column to
44
help ensure that only valid HLCs are stored

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Ecto.HLClock.Mixfile do
1212
description: description(),
1313
package: package(),
1414
deps: deps(),
15-
name: "Ecto.HLClock",
15+
name: "EctoHLClock",
1616
source_url: @source_url,
1717
docs: [
1818
source_url: @source_url,
@@ -37,7 +37,7 @@ defmodule Ecto.HLClock.Mixfile do
3737
[
3838
{:ecto, "~> 3.0"},
3939
{:ecto_sql, "~> 3.0"},
40-
{:hlclock, "~> 0.1"},
40+
{:hlclock, "~> 1.0"},
4141
{:credo, "~> 1.0", only: [:dev, :test]},
4242
{:dialyxir, "~> 0.5", only: :dev, runtime: false},
4343
{:ex_doc, "~> 0.19", only: :dev, runtime: false}

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"ecto": {:hex, :ecto, "3.0.7", "44dda84ac6b17bbbdeb8ac5dfef08b7da253b37a453c34ab1a98de7f7e5fec7f", [:mix], [{:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"},
1111
"ecto_sql": {:hex, :ecto_sql, "3.0.5", "7e44172b4f7aca4469f38d7f6a3da394dbf43a1bcf0ca975e958cb957becd74e", [:mix], [{:db_connection, "~> 2.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.0.6", [hex: :ecto, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.9.1", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.14.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.3.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"},
1212
"ex_doc": {:hex, :ex_doc, "0.19.3", "3c7b0f02851f5fc13b040e8e925051452e41248f685e40250d7e40b07b9f8c10", [:mix], [{:earmark, "~> 1.2", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
13-
"hlclock": {:hex, :hlclock, "0.1.6", "ca4de3f8b3eb410e29de8273cb060a265fe89d5498a272efc58619753764d0c7", [:mix], [], "hexpm"},
13+
"hlclock": {:hex, :hlclock, "1.0.0", "7a72fc7a20a9382499216227edf97a8b118e21fc3fcad0e81b8d10c616ce1431", [:mix], [], "hexpm"},
1414
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
1515
"makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
1616
"makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"},

test/ecto/hclock_test.exs

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/ecto_hclock_test.exs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
defmodule EctoHLClockTest do
2+
use ExUnit.Case
3+
4+
alias EctoHLClock
5+
alias HLClock.Timestamp
6+
7+
describe "EctoHLClock" do
8+
test "cast/1" do
9+
t0 = Timestamp.new(System.os_time(:millisecond), 0, 0)
10+
{:ok, t1} = EctoHLClock.cast(t0)
11+
assert t0 == t1
12+
13+
{:ok, t2} = t0 |> Timestamp.encode() |> EctoHLClock.cast()
14+
assert t0 == t2
15+
end
16+
17+
test "load/1 and dump/1 are symmetric" do
18+
t0 = Timestamp.new(System.os_time(:millisecond), 0, 0)
19+
{:ok, bin} = EctoHLClock.dump(t0)
20+
{:ok, t1} = EctoHLClock.load(bin)
21+
assert Timestamp.compare(t0, t1) == :eq
22+
end
23+
end
24+
end

0 commit comments

Comments
 (0)