juanldslv

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 ? :thinking:

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

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

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

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)> 

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New

We're in Beta

About us Mission Statement