elixir-toniq / ecto_hlclock

Custom Ecto Type for using the HLClock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EctoHLClock

Provides the necessary Ecto type information for hybrid logical clocks.

Installation

Now available in Hex, the package can be installed by adding ecto_hlclock to your list of dependencies in mix.exs:

def deps do
  [
    {:ecto_hlclock, "~> 0.1.0"}
  ]
end

Migration

Adding an HLC column relies on using a :binary column type (currently, only verified against Postgres):

# create a required HLC column on an existing database
alter table (:your_table) do
  add :hlc_column, :binary, null: false
end

EctoHLClock.Migration.create_hlc_constraint(:your_table, :hlc_column)

create_hlc_constraint, by design, creates a deterministic naming convention for the constraints that it enforces, so it should be compatible with changesets. See relevant logs for more information.

About

Custom Ecto Type for using the HLClock

License:Apache License 2.0


Languages

Language:Elixir 100.0%