Created
December 25, 2015 14:20
-
-
Save andreaseriksson/57e82a8ead26c6091fb6 to your computer and use it in GitHub Desktop.
Ecto queries
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
alias FlowCreatorTest.Repo | |
alias FlowCreatorTest.Customer | |
import Ecto.Query | |
Repo.insert(%Customer{email: "[email protected]", customer_fields: %{"foo_id" => "123"} }) | |
Repo.all(from c in Customer, where: fragment("?->>'foo_id' ilike ?", c.customer_fields, "123")) | |
Repo.one(from c in Customer, where: fragment("?->>? ilike ?", c.customer_fields, "foo_id", "123")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment