Is it possible to add a function to `MyApp.Repo`?

Hi,

I have various instances where I’m soft deleting records:

record |> Module.changeset(deleted_at: DateTime.utc_now()) |> Repo.update()

If it possible to add a soft_delete function to the MyApp.Repo module, that allows me to soft delete in one command?

Ideally I’d do MyApp.soft_delete(record) and that would perform the above code.

I appreciate this would be easy to do with an extra module, I was just curious if it’s possible to add it to the base MyApp.Repo module instead.

Thanks in advance

It’s a module in your codebase. You can add whatever you want to it.

I didn’t realise it was already a module defined in the app - I thought it was just ecto magic :man_facepalming:

Thanks for the help!