-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds definition of append only behaviour, #1
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
defmodule Append.AppendOnlyLog do | ||
@moduledoc """ | ||
Behaviour that defines functions for accessing and inserting data in an | ||
Append-Only database | ||
""" | ||
|
||
@callback insert(struct) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()} | ||
@callback get(integer) :: Ecto.Schema.t() | nil | no_return() | ||
@callback update(Ecto.Schema.t(), struct) :: | ||
{:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()} | ||
|
||
defmacro __using__(_opts) do | ||
quote do | ||
@behaviour Append.AppendOnlyLog | ||
|
||
def insert(attrs) do | ||
end | ||
|
||
def get(id) do | ||
end | ||
|
||
def update(%__MODULE__{} = item, attrs) do | ||
end | ||
|
||
end | ||
end | ||
end |