Ecto Basics step by step
Build a plain simple Ecto app step-by-step
create a new project
#validations #constraints
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 new ecommerce_engine --sup |
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
defmodule EcommerceEngine.Product do | |
end |
create struct
make schema
Validations?
use changeset
create changeset for update
1
2
3
4
5
6
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
1
2
3
4
5
class Base
def two
1 + 1
end
end
class Base
def two
1 + 1
end
end
defmodule Foo.Bar do
def three do
1 + two()
end
defp two do
2
end
end