-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Is there a better way to find something by a name/id? This below works, but seems like the named parameter way should work too.
def find(email) do
# Works fine, but I want to use the key
# Diplomat.Query.new("select * from `User` where email_address = @email", %{email: email} )
"select * from User where __key__ = KEY(User, \"#{email}\")"
|> Diplomat.Query.new
|> Diplomat.Query.execute
|> hd
endWhen I use the names params:
def find2(email) do
Diplomat.Query.new("select * from User where __key__ = KEY(User, @email)", %{email: email})
|> Diplomat.Query.execute
endI get:
iex(1)> u = User.find2("[email protected]")
{:error,
%Diplomat.Proto.Status{
code: 3,
details: [],
message: "Encountered \"@email\" at line 1, column 46.\nWas expecting one of:\n <INTEGER> ...\n <SINGLE_QUOTE_STRING> ...\n <DOUBLE_QUOTE_STRING> ...\n "
}}
iex(2)>
Semi-new to Google Data Store so I could be missing something simple.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels