Closed zoedsoupe closed 8 months ago
@joeljuca
insert/2
and insert!/2
functions for now check for compile time %__MODULE__{}
… that can be a problem because the usage of use SwissSchema
can only be made after the ecto schema definition.
THis can be a major API change. If you prefer I can move this checking into runtime!
Zoey,
I’m not sure I understand the problem. Could you elaborate the problem of using %MODULE{} to match the struct of a given schema?
On Sun, 3 Dec 2023 at 3:13 PM Zoey de Souza Pessanha < @.***> wrote:
@joeljuca https://github.com/joeljuca
insert/2 and insert!/2 functions for now check for compile time %MODULE{}… that can be a problem because the usage of use SwissSchema can only be made after the ecto schema definition.
THis can be a major API change. If you prefer I can move this checking into runtime!
— Reply to this email directly, view it on GitHub https://github.com/joeljuca/swiss_schema/pull/16#issuecomment-1837556760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFEQXDTWZCMR74LAQVL4GDYHS6LPAVCNFSM6AAAAABAE6IZMKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGU2TMNZWGA . You are receiving this because you were mentioned.Message ID: @.***>
@zoedsoupe I just saw that this is a PR, not an issue. Sorry – my previous comment came before I had a chance to review your PR, but I'll sure take some time to take a closer look at it tomorrow.
Hi @zoedsoupe,
I've extracted the work you've done in this PR as three separate commits, listed right below. Thanks for the contributions!
test: add tests for insert!/2
(3215b9a04c17ee7f48700510d50f51d0f5edc300)feat: support custom changesets thru a :changeset opt
(dbca8557346d6d81aa555d5bc1c0c2b1ca95465d)chore: add a @callback for changeset/2
(14f83ed0232f2ae2e23839a5bbace7ec9c3adae9)I stepped forward and extracted your work into separate commits because this PR came in with too much code for multiple issues that needed additional discussions and polishing – and since there are conflicts with changes introduced in the meantime I thought it best to step in and give it a hand.
I properly credited you as a co-author in all commits, and you're now listed as a contributor to the project. Welcome!
I encourage you to open additional PRs to address each issue you might think the project would benefit from. Don't be shy to open multiple PRs – it's better to review smaller, single-responsibility PRs than review bigger ones that address multiple issues at once. :)
Rationale
Support custom changesets with the
:changeset
option for the following functions:create/2
create!/2
update/2
update!/2
Also add support for
nix
building and development environment. If you don't agree with this change, I can remove it from the repo.Finally,
insert/2
andinsert!/2
behaviour should accept only built changesets or structs, to differenciate from thecreate/2
andcreate!/2
functions. What do you think about it?See #15.