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
iex(2)> defmodule MyApp.MigrationExample do | |
...(2)> use Ecto.Migration | |
...(2)> | |
...(2)> def up do | |
...(2)> "CREATE TABLE user(id serial PRIMARY_KEY, username text)" | |
...(2)> end | |
...(2)> | |
...(2)> def down do | |
...(2)> "DROP TABLE user" | |
...(2)> 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
First step is to create a new project | |
mix new ecto_quickstart | |
cd ecto_quickstart/ | |
Next edit your ./mix.exs to include the dependencies for ecto | |
defmodule EctoQuickstart.Mixfile do | |
use Mix.Project | |
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
defrecord Foo, date:nil,total:nil,data,nil | |
JSON.decode!("[{\"date\":\"1/1/2014\",\"total\":10.0,\"data\":\"foo\"}]", as: Foo) | |
** (FunctionClauseError) no function clause matching in Foo.new/1 | |
iex:1: Foo.new([[{"date", "1/1/2014"}, {"total", 10.0}, {"data", "foo"}]]) |
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
1) test imports data to db (ToDB) | |
** (FunctionClauseError) no function clause matching in JSON.Encoder.BitString.encode/2 | |
stacktrace: | |
lib/json/encoder.ex:144: JSON.Encoder.BitString.encode(<< redacted >>, :unicode) | |
lib/json/encoder.ex:147: JSON.Encoder.BitString.encode/2 | |
lib/json/encoder.ex:147: JSON.Encoder.BitString.encode/2 | |
lib/json/encoder.ex:141: JSON.Encoder.BitString.to_json/2 | |
lib/json/encoder.ex:12: JSON.Encode.it/2 | |
lib/json.ex:12: JSON.encode!/2 | |
lib/json/encoder.ex:89: anonymous fn/2 in JSON.Encoder.List.encode_object/3 |
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
mix ecto.migrate Repo | |
Compiled lib/webapprevdash2/supervisor.ex | |
Compiled lib/webapprevdash2.ex | |
Generated webapprevdash2.app | |
** (FunctionClauseError) no function clause matching in :filename.do_flatten/2 | |
(stdlib) filename.erl:931: :filename.do_flatten({:error, :bad_name}, []) | |
(stdlib) filename.erl:635: :filename.split/1 | |
(elixir) lib/path.ex:224: Path.relative_to/2 | |
lib/mix/tasks/ecto.ex:60: Mix.Tasks.Ecto.migrations_path/1 | |
lib/mix/tasks/ecto.migrate.ex:51: Mix.Tasks.Ecto.Migrate.run/2 |
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
** (EXIT) {:badarg, [{:unicode, :characters_to_binary, [[compressed: false, memory: 27015, owner: #PID<0.652.0>, | |
heir: :none, name: :"0253274", size: 44, node: :nonode@nohost, named_table: true, type: :set, keypos: 1, | |
protection: :protected]], []}, {String, :from_char_list!, 1, [file: 'lib/string.ex', line: 1188]}, {Streamer, | |
:del_ets, 1, [file: 'lib/streamer.ex', line: 105]}, {Streamer, :senda, 3, [file: 'lib/streamer.ex', line: 89]}, | |
{Enum, :"-each/2-lists^foreach/1-0-", 2, [file: 'lib/enum.ex', line: 517]}, {Enum, :each, 2, [file: 'lib/enum.ex', | |
line: 517]}, {Werk, :"-fn_sendaworker/1-fun-1-", 2, [file: 'lib/work.ex', line: 30]}, {Workex.Worker, :exec_job, 2, | |
[file: 'lib/worker.ex', line: 34]}]} |
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
1) test can send proxy email message: stubbed (InfuTest) | |
** (EXIT) {:badarg, [{:unicode, :characters_to_binary, [[AAA957E6927471FF9EADE64D79FE07D52: {2, 1}]], []}, {String, | |
:from_char_list!, 1, [file: 'lib/string.ex', line: 1188]}, {Infu.Router, :send_email, 2, [file: 'lib/infu.ex', line: 15 | |
3]}, {Infu.Router, :handle_call, 3, [file: 'lib/infu.ex', line: 77]}, {:gen_server, :handle_msg, 5, [file: 'gen_server.e | |
rl', line: 588]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 239]}]} |
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
defmodule Check do | |
require Lager | |
use Phoenix.Controller | |
def authed?(conn,f) do | |
try do | |
user = get_user_for_request(conn) | |
token = get_token_for_request(conn) | |
if (token != "xxx1xxx") do | |
Lager.error "bad token error" | |
raise "bad Token" |
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
defmodule Bulk do | |
require Lager | |
@place 15 | |
def bwrite(filename,sep) do | |
Lager.info "destroying directory ./import" | |
clean | |
make_utl | |
setup_import_dir | |
Lager.info "opening file #{filename}" | |
streams = make_stream(filename,sep) |
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
defmodule TstLeak do | |
require Lager | |
def prove_bug(filename,sep) do | |
make_utl | |
setup_mem | |
Enum.reduce(make_stream(filename,sep),0,fn(s,count) -> | |
list = Enum.to_list(s) | |
print_if(50000,count) | |
count + 1 | |
end) |
OlderNewer