shahryarjb
Hello, how do I get struct in array ? please see my pic :
I need to get the struct’s params , like this : a.cms_post.title
My output is :
[
%TrangellCmsService.Cms.Db.Post{
__meta__: #Ecto.Schema.Metadata<:loaded, "cms_post">,
changelog: true,
changelog_category: "/ss/ppos",
cms_post_category: #Ecto.Association.NotLoaded<association :cms_post_category is not loaded>,
cms_post_category_id: "960c30f2-183e-4430-a96d-4f0fd41fe37b",
description: "test test test test test test tetststststss tskkkstest of test fo test of test more test more test for test for test tes",
discourse: true,
discourse_link: "/ss/ppos",
download_ext_link: "/ss/ppos",
group_acl: "admin",
id: 6,
inserted_at: ~N[2018-04-29 11:45:05.311436],
learn: true,
learn_category: "/ss/ppos",
pic_x1_link: "/ss/ppos",
pic_x2_link: "/ss/ppos",
pic_x3_link: "/ss/ppos",
plugin: true,
plugin_category: "/ss/ppos",
post_type: "free",
price: "30000",
screen_shot: false,
screen_shot_category: "/ss/ppos",
seo_alias_link: "7seo-why-seo",
seo_description: "for the test for test for test for test tete of test",
seo_language: "fa",
seo_language_link: "/ss/ppos",
seo_tag: "test,test,test,test",
seo_words: "test,test,test,test",
status: true,
title: "shahryar",
updated_at: ~N[2018-04-29 11:45:05.311884]
}
]
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 know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
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
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
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
- #ecto-query
- #ai
- #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 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
Not array, it is a linked list, and you can use the usual iteration functions from the
Enummodule.You can not directly acces the fields because it’s ambiguous which of the potentially many lists contents you want to access.
shahryarjb
Do you prefer pattern or
Enum? for example :I created func like this :
Now , I get this like this way :
by the way, although my problem is solved, but I couldn’t find correct
Enumto fix my problem.peerreynders
Something like
would return a list of title values
Map.get/3Enum.map/2returns the title of the post in the head of the list
Kernel.hd/1i.e. using pattern matching for destructuring rather than dot notation.
shahryarjb
Hello @peerreynders , thank you ,
I was trying very much, but I couldn’t use
Map,Enumin my original outputsmy original outputs : data.ex · GitHub
the
postvariable which I linked ingithub gistEiji
@shahryarjb If I understand you correctly then this code should help you:
shahryarjb
Hello @Eiji , I edited the code to improve my project , I think my way isn’t right, Do you think like me?
Eiji
@shahryarjb: Sorry, but I don’t know few things:
category_aliasvariable -"jsjsjs"?group_aclvariable - root list from gist ?fetch_posts_by_category_aliasfunction bodyIf I assumed correctly (about your variables) then:
shahryarjb
I am sorry for this and thank you again,
the
Category_aliasis unique slug link which indexed in my database, for this purpose my client searches with it. andgroup_aclis user’s access,At the end,
fetch_posts_by_category_aliasis :My problem started since I used
preload,preloaddoesn’t let me filter my output at first.my all codes :
Eiji
@shahryarjb: Then it’s really simple. Assuming you want only list of titles:
shahryarjb
I know this , but I want to use
preload, withoutpreloadis simple and very clear, so why waspreloadmade , really? and where I use this ?