Skip to content

Commit 0f86965

Browse files
committed
Update naming scheme
1 parent 4f5dccd commit 0f86965

6 files changed

Lines changed: 29 additions & 29 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: 1 addition & 1 deletion
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,

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)