Open zoedsoupe opened 5 months ago
I'm thinking about the functions that would make sense to receive such opt. I listed below the ones that seem to make sense:
get/2
, get!/2
, get_by/2
, get_by!/2
, and all/1
(Ecto.Repo Query API)insert/2
, insert!/2
, insert_or_update/2
, insert_or_update!/2
(Ecto.Repo Schema API)create/2
and create!/2
(SwissSchema API)WDYT?
Introduction
A cool feature of ecto queries and schemas is to perform cross table join that have associations between them, that way you can retrieve assoc data with simple functions pipelines, as:
Another option is to define a query to retrieve in a single expression the whole structure:
Proposal
I’m proposing a new option to
swiss_schema
functions to apply such preloading assocs on retrieve and creation functions: