Complex structs like %DateTime{} are a good example where the external users are discouraged from pattern matching directly on the struct fields, and should use the functions provided by the module to transform the value.
For Ecto shemas I like to put the functions that produce changesets in the schema module, then the higher level business logic that manages the transaction scope in context module function, or even a dedicated module for handling each command.


















