I hereby claim:
- I am aleandros on github.
- I am aleandros (https://keybase.io/aleandros) on keybase.
- I have a public key ASDuXGZwmWw69y2N5o5gVX2XWRbgm1_Nkg8ZhZXZeJWTSQo
To claim this, I am signing this object:
| ;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- | |
| ;; Place your private configuration here! Remember, you do not need to run 'doom | |
| ;; sync' after modifying this file! | |
| ;; Some functionality uses this to identify you, e.g. GPG configuration, email | |
| ;; clients, file templates and snippets. | |
| (setq user-full-name "E..." | |
| user-mail-address "e....") |
I hereby claim:
To claim this, I am signing this object:
| defmodule MyApp.User do | |
| use MyApp.Web, :model | |
| @primary_key {:UserId, :id, autogenerate: true} | |
| schema "user" do | |
| has_one :credential, MyApp.Credential, | |
| foreign_key: :UserId, | |
| references: :UserId | |
| many_to_many :roles, MyApp.Role, | |
| join_through: MyApp.UserRole, |
| [bank|_] = Repo.all(Bank) | |
| bank.'BankId' # That's it. That's all it takes and it works | |
| # Same for database queries | |
| query = from b in Bank, | |
| where: b.'BankName' == "Bank Inc" |
| query = from b in Bank, | |
| where: field(b, :BankName) == "Bank Inc." |
| [bank|_] = Repo.all(Bank) | |
| # bank is a struct. Structs are maps. | |
| %{BankId: id} = bank # this works | |
| Map.get(bank, :BankId) # this works too | |
| bank.BankId # This does not compile. | |
| # Ecto queries would break as well |
| [bank|_] = Repo.all(Bank) | |
| bank.id # Everything works as expected. |
| defmodule MyApp.Bank do | |
| use MyApp.Web, :model | |
| @primary_key {:BankId, :id, autogenerate: true} # 1 | |
| schema "bank" do # 2 | |
| field :BankName, :string # 3 | |
| timestamps(inserted_at: :BankCreateDate, # 4 | |
| updated_at: :BankUpdateDate) | |
| end | |
| end |
| defmodule MyApp.Bank do | |
| use MyApp.Web, :model | |
| schema "banks" do | |
| field :name, :string | |
| timestamps() | |
| end | |
| end |
| class Symbol | |
| def to_proc | |
| proc do |obj| | |
| obj.send(self) | |
| end | |
| end | |
| end |