Mapping virtual field in Ecto schema to real field in a table

Hello,

I’m trying to find a way to map a virtual field in an Ecto schema to a real field in the table that’s the source of the schema.

The complication is that I don’t want to include the real field in question in the schema.

The idea is to create a “read-only” field in the schema.

Any ideas how I might go about this?

Thank you.

Use a different schema for db interaction vs. the one used for user input and map between them. There are no good solutions to do that within a single schema.

Thank you @LostKobrakai.

Any pointer on how you would map between the schemas?

Read this one: https://hexdocs.pm/ecto/data-mapping-and-validation.html#schemas-are-mappers

Thanks @LostKobrakai!