This file contains hidden or 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
| brew bundle dump | |
| # https://github.com/homebrew/install#uninstall-homebrew | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" | |
| # https://brew.sh/ | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| # restore packages | |
| brew bundle |
This file contains hidden or 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
| Repo.all from u in User, | |
| preload: [{:investiment_funds, :institution}, :transfers] |
This file contains hidden or 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
| Repo.all from u in User, | |
| preload: [:investiment_funds, :transfers] |
This file contains hidden or 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
| Repo.all from u in User, | |
| preload: [:investiment_funds] |
This file contains hidden or 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
| # Create a query | |
| query = from u in User, where: u.age > 18 | |
| # Extend the query | |
| query = from u in query, select: u.name |
This file contains hidden or 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
| classes = (from klass in Class, | |
| order_by: klass.created_at) | |
| query = (from course in Course, | |
| preload: [classes: ^classes]) |
This file contains hidden or 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
| (from c in Course, | |
| join: class in assoc(c, :classes), | |
| preload: [classes: class], | |
| select: c) |
This file contains hidden or 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
| (from c in Course, | |
| preload: [classes: class], | |
| select: c) |
This file contains hidden or 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
| (from c in Course, | |
| select: c) |
This file contains hidden or 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
| def changeset(user, params \\ %{}) do | |
| user | |
| |> cast(params, [:name, :email, :age]) | |
| |> validate_required([:name, :email]) | |
| |> validate_format(:email, ~r/@/) | |
| |> validate_inclusion(:age, 18..100) | |
| |> unique_constraint(:email) | |
| end |
NewerOlder