Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support wrapping plaintext in closure #7

Merged
merged 3 commits into from
Apr 6, 2024

Conversation

voltone
Copy link
Contributor

@voltone voltone commented Jun 29, 2020

@voltone
Copy link
Contributor Author

voltone commented Jul 1, 2020

Just to clarify: it would be possible to implement the core aspect of this feature purely in my application by overriding after_decrypt/1 to return the closure. But that would not support the reverse direction: passing a closure in an insert/update. For that I'd have to unwrap the closure in cast/1, and it is not overridable.

So a minimal change might be instead to make cast/1 overridable in all default types. But I think the benefit of explicit support for this feature in Cloak.Ecto is that it raises awareness of this technique to other users of the library.

@danielberkompas danielberkompas added feature New feature proposal A proposal for a change and removed proposal A proposal for a change labels Jun 17, 2022
Without this, Ecto will make many unnecessary updates to fields, when
the actual wrapped value hasn't changed.
@danielberkompas
Copy link
Owner

This looks great, apologies for the long delay. ⭐

@danielberkompas danielberkompas merged commit 62e6dff into danielberkompas:master Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants