shahryarjb
hello,
I have a challenge which I should do it. I need multi values in my db with Ecto, but I need to pass it like one request
please see my image :
for example when my user calls my router link , I should pass this :
- count all records of category one
- load and count all records of the category one which its version_id = 1 along with its fields
- lists of all version along with its title and id
Do I send 3 Repo.all to my db with Ecto or something else?
I want to create like this : EasyBlog - Changelog for 6.0.18
My client only sends Category Id and I should pass like this Json example :
Category_id == 1
[
category_info: [
count_all_records: 100,
count_all_records_by_version_one: 10
load_list_of_version: [
{
name: "1.5",
id: 1
},
{
name: "1.7",
id: 2
},
{
name: "1.6",
id: 3
},
{
name: "3",
id: 4
}
]
]
category_records: [
{
name: "bug fix 1",
id: 1
version_id: 1
},
{
name: "bug fix 2",
id: 3
version_id: 3
},
{
name: "bug fix 3",
id: 10
version_id: 3
},
]
]
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
peerreynders
This part doesn’t make any sense.
versionholds “zero or more” versions for any onecategory. Soversion.id = 1would belong to exactly onecategory.min(version.id)(or more likelymax(version.id)for the specified singlecategory.shahryarjb
unfortunately I didn’t understand what you said, I’m sorry.
version.titleis a string field andversion_idrelationed with record table, In fact, this is a filter, if it doesn’t answer me, so what do I do? I’m confused.I just need to get table records which relation with
Versiontable in the Category concerned( category id = 2) . how can I do? I’m new to this field , I sorry and thank you for giving me your time.shahryarjb
Ok , hmm, now I know it , but what is your suggestion? but I think it isn’t only problem , my main problem is how to write query for this , even if this logic is wrong.I’m confused.

So, I am thinking my way may be right, because at first, I print all Version of category which relation, and my user selects each one and sends it.
My
version_idis aUUID, for this purpose, I want to print all versions of category with other query. if my client didn’t send anyversion_id, I would selectmax(version_title)of category which relation it.Is my idea correct?
peerreynders
This is the organization that makes sense to me:
shahryarjb
At first, I am very grateful to you.
it seems that I need to use Query 2, it works with normal ID like integer, but I am using UUID, or I have to use normal ID or I should find the way which I will be able to fix it.
Your Post and codes are the best practice for me, Thank you.
Edited
I edited like this :
Versionsfunction is true, butcountsfunction which has a problem shows me this :Edit 2
I edited again :
The previous problem was solved but …
peerreynders
It seems that PostgreSQL can’t compare UUIDs directly but only use them in JOINS. Try this version: