joeljuca / swiss_schema

A Swiss Army knife for your Ecto schemas
https://hex.pm/packages/swiss_schema
Apache License 2.0
27 stars 3 forks source link

Support custom changesets #16

Closed zoedsoupe closed 8 months ago

zoedsoupe commented 10 months ago

Rationale

Support custom changesets with the :changeset option for the following functions:

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 and insert!/2 behaviour should accept only built changesets or structs, to differenciate from the create/2 and create!/2 functions. What do you think about it?

See #15.

zoedsoupe commented 10 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!

joeljuca commented 10 months ago

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: @.***>

joeljuca commented 10 months ago

@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.

joeljuca commented 8 months ago

Hi @zoedsoupe,

I've extracted the work you've done in this PR as three separate commits, listed right below. Thanks for the contributions!

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