juanldslv
What is the meaning of '=>' ? Repo.all()
Hi guys, I hope that all are good, now, Im trying to make a query into a function but when I sent the query for repo.all, this is the answer is ‘=>’ that the repo give me. does anyone know about it ? ![]()
defp historia_clinica_medico(paciente)do
IO.inspect(Repo.all(from h in Sim.HistorialHistoriaClinica, where: h.paciente_id == ^paciente
and not is_nil(h.historiaclinicamedico_id), select: h.historiaclinicamedico_id))
end
thank you for all advices as much as code or my poor English language
Marked As Solved
david_ex
This looks suspiciously like iex displaying a list of integers as charlists. Can you try the following in iex?
result = Repo.all(from h in Sim.HistorialHistoriaClinica, where: h.paciente_id == ^paciente
and not is_nil(h.historiaclinicamedico_id), select: h.historiaclinicamedico_id)
inspect result, char_lists: :as_lists
i result
Does the result make more sense to you? If yes, you can find more information about it in the charlists section of the guide, and this issue has helpful information also.
Also Liked
peerreynders
In particular:
iex(1)> list_of_ids = [61, 62]
'=>'
iex(2)> IO.inspect(list_of_ids)
'=>'
'=>'
iex(3)> IO.inspect(list_of_ids, [charlists: :as_lists])
[61, 62]
'=>'
iex(4)> to_string(list_of_ids)
"=>"
iex(5)>
i.e. the query returned a list of two historiaclinicamedico_id values, 61 and 62 respectively.
peerreynders
There really isn’t enough information to give an answer. For example:
iex(1)> alias MusicDB.Track
MusicDB.Track
iex(2)> import Ecto.Query
Ecto.Query
iex(3)> album_id = 5
5
iex(4)> IO.inspect(Repo.all(from t in Track, where: t.album_id == ^album_id and not is_nil(t.id), select: t.id))
20:04:17.914 [debug] QUERY OK source="tracks" db=2.0ms
SELECT t0."id" FROM "tracks" AS t0 WHERE ((t0."album_id" = $1) AND NOT (t0."id" IS NULL)) [5]
[33, 32, 31, 30]
[33, 32, 31, 30]
iex(5)>
=> typically appears in the representation of Elixir maps where the keys aren’t atoms.
iex(5)> IO.inspect(Map.new([{"a",1},{"b",2}]))
%{"a" => 1, "b" => 2}
%{"a" => 1, "b" => 2}
iex(6)>
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









