Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mix: update to latest elixir

  • Loading branch information...
commit 8ee23b3d73445e2d6ee18f3df04a115aa6ffcdea 1 parent 71928a4
meh. authored
8 lib/amnesia/database.ex
View
@@ -65,7 +65,7 @@ defmodule Amnesia.Database do
"""
@spec create :: [Amnesia.Table.o]
@spec create(Amnesia.Table.c) :: [Amnesia.Table.o]
- def create(copying // []) do
+ def create(copying \\ []) do
[ metadata.create(copying: copying) |
Enum.map @tables, fn(table) ->
@@ -79,7 +79,7 @@ defmodule Amnesia.Database do
"""
@spec create! :: [Amnesia.Table.o]
@spec create!(Amnesia.Table.c) :: [Amnesia.Table.o]
- def create!(copying // []) do
+ def create!(copying \\ []) do
metadata.create!(copying: copying)
Enum.each @tables, fn(table) ->
@@ -122,7 +122,7 @@ defmodule Amnesia.Database do
"""
@spec wait :: :ok | { :timeout, [atom] } | { :error, atom }
@spec wait(integer | :infinity) :: :ok | { :timeout, [atom] } | { :error, atom }
- def wait(timeout // :infinity) do
+ def wait(timeout \\ :infinity) do
Amnesia.Table.wait(@tables, timeout)
end
end
@@ -169,7 +169,7 @@ defmodule Amnesia.Database do
@spec deftable(atom, [atom | { atom, any }]) :: none
@spec deftable(atom, [atom | { atom, any }], Keyword.t) :: none
@spec deftable(atom, [atom | { atom, any }], Keyword.t, Keyword.t) :: none
- defmacro deftable(name, attributes // nil, opts // [], do_block // []) do
+ defmacro deftable(name, attributes \\ nil, opts \\ [], do_block \\ []) do
if attributes do
[ Amnesia.Table.deftable!(__CALLER__.module, name, attributes, Keyword.merge(opts, do_block)),
4 lib/amnesia/schema.ex
View
@@ -28,7 +28,7 @@ defmodule Amnesia.Schema do
"""
@spec create :: :ok | { :error, any }
@spec create([node]) :: :ok | { :error, any }
- def create(nodes // [node]) do
+ def create(nodes \\ [node]) do
:mnesia.create_schema(nodes)
end
@@ -37,7 +37,7 @@ defmodule Amnesia.Schema do
"""
@spec destroy :: :ok | { :error, any }
@spec destroy([node]) :: :ok | { :error, any }
- def destroy(nodes // [node]) do
+ def destroy(nodes \\ [node]) do
:mnesia.delete_schema(nodes)
end
end
52 lib/amnesia/table.ex
View
@@ -16,7 +16,7 @@ defmodule Amnesia.Table do
"""
@spec wait([atom]) :: :ok | { :timeout, [atom] } | { :error, atom }
@spec wait([atom], integer | :infinity) :: :ok | { :timeout, [atom] } | { :error, atom }
- def wait(names, timeout // :infinity) do
+ def wait(names, timeout \\ :infinity) do
:mnesia.wait_for_tables(names, timeout)
end
@@ -41,7 +41,7 @@ defmodule Amnesia.Table do
"""
@spec create(atom) :: o
@spec create(atom, c) :: o
- def create(name, definition // []) do
+ def create(name, definition \\ []) do
args = Keyword.new
args = Keyword.put(args, :record_name, Keyword.get(definition, :record, name))
@@ -144,7 +144,7 @@ defmodule Amnesia.Table do
"""
@spec create!(atom) :: :ok | no_return
@spec create!(atom, c) :: :ok | no_return
- def create!(name, definition // []) do
+ def create!(name, definition \\ []) do
case create(name, definition) do
:ok ->
:ok
@@ -333,7 +333,7 @@ defmodule Amnesia.Table do
"""
@spec add_copy(atom, node) :: o
@spec add_copy(atom, node, cv) :: o
- def add_copy(name, node, type // :disk) do
+ def add_copy(name, node, type \\ :disk) do
:mnesia.add_table_copy(name, node, case type do
:disk -> :disc_copies
:disk! -> :disc_only_copies
@@ -461,7 +461,7 @@ defmodule Amnesia.Table do
"""
@spec read(atom, any) :: [record] | no_return
@spec read(atom, any, :read | :write | :write!) :: [record] | nil | no_return
- def read(name, key, lock // :read) do
+ def read(name, key, lock \\ :read) do
case :mnesia.read(name, key, case lock do
:read -> :read
:write -> :write
@@ -775,7 +775,7 @@ defmodule Amnesia.Table do
`mnesia:match_object`.
"""
@spec match(atom, any, :read | :write) :: [record] | nil | no_return
- def match(name, pattern, lock // :read) do
+ def match(name, pattern, lock \\ :read) do
Match.new(:mnesia.match_object(name, pattern, lock))
end
@@ -809,7 +809,7 @@ defmodule Amnesia.Table do
"""
@spec to_sequence(atom) :: Amnesia.Table.Sequence.t
@spec to_sequence(atom, :read | :write | :write!) :: Amnesia.Table.Sequence.t
- def to_sequence(name, lock // :read) do
+ def to_sequence(name, lock \\ :read) do
Amnesia.Table.Sequence.new(name, type(name), lock: lock)
end
@@ -832,7 +832,7 @@ defmodule Amnesia.Table do
"""
@spec delete(atom, any) :: :ok | no_return
@spec delete(atom, any, :write | :write!) :: :ok | no_return
- def delete(name, key, lock // :write) do
+ def delete(name, key, lock \\ :write) do
:mnesia.delete(name, key, case lock do
:write -> :write
:write! -> :sticky_write
@@ -858,7 +858,7 @@ defmodule Amnesia.Table do
"""
@spec write(atom, record) :: :ok | no_return
@spec write(atom, record, :write | :write!) :: :ok | no_return
- def write(name, data, lock // :write) do
+ def write(name, data, lock \\ :write) do
:mnesia.write(name, data, case lock do
:write -> :write
:write! -> :sticky_write
@@ -883,7 +883,7 @@ defmodule Amnesia.Table do
end
@doc false
- def deftable!(database, name, attributes, opts // []) do
+ def deftable!(database, name, attributes, opts \\ []) do
if length(attributes) <= 1 do
raise ArgumentError, message: "the table attributes must be more than 1"
end
@@ -943,7 +943,7 @@ defmodule Amnesia.Table do
"""
@spec wait :: :ok | { :timeout, [atom] } | { :error, atom }
@spec wait(integer | :infinity) :: :ok | { :timeout, [atom] } | { :error, atom }
- def wait(timeout // :infinity) do
+ def wait(timeout \\ :infinity) do
Amnesia.Table.wait([__MODULE__], timeout)
end
@@ -960,13 +960,13 @@ defmodule Amnesia.Table do
"""
@spec create :: Amnesia.o
@spec create(Amnesia.Table.c) :: Amnesia.o
- def create(copying // []) do
+ def create(copying \\ []) do
Amnesia.Table.create(__MODULE__, attributes(copying))
end
@spec create! :: :ok | no_return
@spec create!(Amnesia.Table.c) :: :ok | no_return
- def create!(copying // []) do
+ def create!(copying \\ []) do
Amnesia.Table.create!(__MODULE__, attributes(copying))
end
@@ -1083,7 +1083,7 @@ defmodule Amnesia.Table do
"""
@spec add_copy(node) :: Amnesia.Table.o
@spec add_copy(node, Amnesia.Table.cv) :: Amnesia.Table.o
- def add_copy(node, type // :disk) do
+ def add_copy(node, type \\ :disk) do
Amnesia.Table.add_copy(__MODULE__, node, type)
end
@@ -1194,7 +1194,7 @@ defmodule Amnesia.Table do
"""
@spec read(any) :: [t] | nil | no_return
@spec read(any, :read | :write | :write!) :: [t] | nil | no_return
- def read(key, lock // :read) do
+ def read(key, lock \\ :read) do
records = Amnesia.Table.read(__MODULE__, key, lock)
case hook_read(key, records) do
@@ -1235,7 +1235,7 @@ defmodule Amnesia.Table do
"""
@spec read(any) :: t | nil | no_return
@spec read(any, :read | :write | :write!) :: t | nil | no_return
- def read(key, lock // :read) do
+ def read(key, lock \\ :read) do
record = case Amnesia.Table.read(__MODULE__, key, lock) do
[r] -> r
_ -> nil
@@ -1333,7 +1333,7 @@ defmodule Amnesia.Table do
@spec first :: t | nil | no_return
@spec first(boolean) :: any | t | nil | no_return
@spec first(boolean, atom) :: any | t | nil | no_return
- def first(key // false, lock // :read)
+ def first(key \\ false, lock \\ :read)
def first(true, lock) do
Amnesia.Table.first(__MODULE__)
@@ -1353,7 +1353,7 @@ defmodule Amnesia.Table do
"""
@spec first! :: any | t | nil | no_return
@spec first!(boolean) :: any | t | nil | no_return
- def first!(key // false)
+ def first!(key \\ false)
def first!(false) do
read!(Amnesia.Table.first!(__MODULE__))
@@ -1442,7 +1442,7 @@ defmodule Amnesia.Table do
@spec last :: t | nil | no_return
@spec last(boolean) :: any | t | nil | no_return
@spec last(boolean, atom) :: any | t | nil | no_return
- def last(key // false, lock // :read)
+ def last(key \\ false, lock \\ :read)
def last(true, lock) do
Amnesia.Table.last(__MODULE__)
@@ -1462,7 +1462,7 @@ defmodule Amnesia.Table do
"""
@spec last! :: any | t | nil | no_return
@spec last!(boolean) :: any | t | nil | no_return
- def last!(key // false)
+ def last!(key \\ false)
def last!(false) do
read!(Amnesia.Table.last!(__MODULE__))
@@ -1519,7 +1519,7 @@ defmodule Amnesia.Table do
* `qualified' - whether to set a name for the record or not
"""
- defmacro where(spec, options // []) do
+ defmacro where(spec, options \\ []) do
options = Keyword.put(options, :where, spec)
quote do
@@ -1566,7 +1566,7 @@ defmodule Amnesia.Table do
* `qualified' - whether to set a name for the record or not
"""
- defmacro where!(spec, options // []) do
+ defmacro where!(spec, options \\ []) do
options = Keyword.put(options, :where, spec)
quote do
@@ -1605,7 +1605,7 @@ defmodule Amnesia.Table do
"""
@spec match(any) :: [t] | nil | no_return
@spec match(:read | :write, any) :: [t] | nil | no_return
- defmacro match(lock // :read, pattern) do
+ defmacro match(lock \\ :read, pattern) do
quote do
Amnesia.Table.match(unquote(__MODULE__),
unquote(__MODULE__)[unquote_splicing(pattern), { :_, :_ }], unquote(lock))
@@ -1645,7 +1645,7 @@ defmodule Amnesia.Table do
"""
@spec to_sequence :: Amnesia.Table.Sequence.t
@spec to_sequence(:read | :write | :write!) :: Amnesia.Table.Sequence.t
- def to_sequence(lock // :read) do
+ def to_sequence(lock \\ :read) do
Amnesia.Table.to_sequence(__MODULE__, lock)
end
@@ -1713,7 +1713,7 @@ defmodule Amnesia.Table do
Write the record to the table, see `mnesia:write`.
"""
@spec write(t) :: t | no_return
- def write(lock // :write, self) do
+ def write(lock \\ :write, self) do
case hook_write(self) do
:undefined ->
Amnesia.Table.write(__MODULE__, self, lock)
@@ -1748,7 +1748,7 @@ defmodule Amnesia.Table do
counter if `nil`.
"""
@spec write(t) :: t | no_return
- def write(lock // :write, self) do
+ def write(lock \\ :write, self) do
self = autoincrement(self)
case hook_write(self) do
2  mix.exs
View
@@ -4,7 +4,7 @@ defmodule Amnesia.Mixfile do
def project do
[ app: :amnesia,
version: "0.1.1",
- elixir: "~> 0.12.2",
+ elixir: "~> 0.12.3",
deps: deps ]
end
6 mix.lock
View
@@ -1,3 +1,3 @@
-[ "continuum": {:git, "git://github.com/meh/continuum.git", "7845187fa814bdfa6938db7f3a2341b742b0aa61", []},
- "datastructures": {:git, "git://github.com/meh/elixir-datastructures.git", "8b497974ad511965dac5fe9e7b9b8762e1632a22", []},
- "exquisite": {:git, "git://github.com/meh/exquisite.git", "2631561238a17863e7b49ab2948c90919e255675", []} ]
+[ "continuum": {:git, "git://github.com/meh/continuum.git", "057353cc4fc59c5257036e32c4ceea44fdc7a8ec", []},
+ "datastructures": {:git, "git://github.com/meh/elixir-datastructures.git", "28a7aee9addfe521ad0aa62f5e54f1ad597356cc", []},
+ "exquisite": {:git, "git://github.com/meh/exquisite.git", "beff7f389dd4016bffa0ec50b44d80efdd9070b1", []} ]
Please sign in to comment.
Something went wrong with that request. Please try again.