I think it would be massively helpful to have a capability to extend DbCodec built-in so that one can provide an isomorphism between a type for which a DbCodec instance already exists (e.g. DbCodec[String]) and a type that hasn't have an instance. As always - code is better than words so let me present the current workaround:
The instance for TestOpaque can be easily created by just calling bimap on existing instance and providing functions from String to TestOpaque and vice versa.
I think it would be massively helpful to have a capability to extend DbCodec built-in so that one can provide an isomorphism between a type for which a DbCodec instance already exists (e.g.
DbCodec[String]
) and a type that hasn't have an instance. As always - code is better than words so let me present the current workaround:The instance for TestOpaque can be easily created by just calling
bimap
on existing instance and providing functions from String to TestOpaque and vice versa.