rom-rb / rom

Data mapping and persistence toolkit for Ruby
https://rom-rb.org
MIT License
2.07k stars 161 forks source link

Configuration option for struct_namespace #609

Open mereghost opened 3 years ago

mereghost commented 3 years ago

During the rom container setup, if would be very useful to have a struct_namespace setting so that we don't need to pass this to Repositories/Relations.

Another idea is that this could be part of auto_registration under a certain directory (I'm biased towards Entities :p )

Examples

config = ROM::Configuration.new(:sql, 'sqlite::memory:')
config.struct_namespace SomeConstant::Maybe::MultiLevel

This would reduce the amount of boilerplate when setting up repositories & relations needed. Of course, a local call to struct_namespace should have precedence (for folks who split theirs entities into a bunch of different namespaces).