Adzz / ecto_morph

morph your Ecto capabilities into the s t r a t o s p h e r e !
Apache License 2.0
109 stars 8 forks source link

virtual fields #43

Closed Adzz closed 1 year ago

Adzz commented 3 years ago

Should we have an options to create a struct keeping virtual fields if they exist? The canonical example is password when you explicitly don't want to keep the virtual field. But another example of using them is when you have calculated fields you might want to create with select_merge from the db. If you want to update them later it would be good to be able to: EctoMorph.update_virtual_fields(data, MyStruct) or something.

If you can cast those virtual fields then you can still keep some type safety in them I guess.