-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove :ecto from .formatter.exs see: #2 (comment)
- Loading branch information
Showing
27 changed files
with
306 additions
and
185 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
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
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 |
---|---|---|
@@ -1,27 +1,39 @@ | ||
defmodule UsersTable do | ||
|
||
alias Pockets | ||
|
||
@table (if Mix.env() == :prod do :users_table else :users_test_table end) | ||
@filepath (if Mix.env() == :prod do "cache.dets" else "cache_test.dets" end) | ||
@table (if Mix.env() == :prod do | ||
:users_table | ||
else | ||
:users_test_table | ||
end) | ||
@filepath (if Mix.env() == :prod do | ||
"cache.dets" | ||
else | ||
"cache_test.dets" | ||
end) | ||
|
||
def init() do | ||
case Pockets.new(@table, @filepath) do | ||
# Not testing creating a table because when testing, it loads a sample table. | ||
# coveralls-ignore-start | ||
{:ok, set} -> {:ok, set} | ||
{:ok, set} -> | ||
{:ok, set} | ||
|
||
# coveralls-ignore-end | ||
{:error, _} -> | ||
Pockets.open(@table, @filepath) | ||
end | ||
end | ||
|
||
def create_user(%{:stripe_id => stripe_id, :person_id => person_id, :status => status}) do | ||
def create_user(%{ | ||
:stripe_id => stripe_id, | ||
:person_id => person_id, | ||
:status => status | ||
}) do | ||
Pockets.put(@table, person_id, %{stripe_id: stripe_id, status: status}) | ||
end | ||
|
||
def fetch_user(person_id) do | ||
Pockets.get(@table, person_id) | ||
end | ||
|
||
end |
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
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
Oops, something went wrong.