[Dbix-class] Components for ResultSets?

Calle Dybedahl calle at init.se
Wed May 5 12:29:51 GMT 2010


Hi there.

I'm involved in a project that's currently migrating from an old home-grown database interface to DBIx::Class. So far, it's going well. But recently I've run into something that I haven't been able to figure out how to do.

We have 130ish tables. There are some subsets of them that share certain things. For example, a handful have columns that self-join to describe tree-like structures between rows. 

Naturally, we'd like to keep these different things isolated and non-repeated. For row-level functions, it's easy to do this with components. But I can't see how to do it for table-level functions (for example, a method to re-balance all the tree-like things mentioned above in a certain table). At the moment, we keep the functions needed in a subclass to DBIx::Class::Resultset, which works. But it means having those functions available for tables where they don't make sense (or work), and having different kinds of functionalities in the same module. We can also see this subclass becoming very large in the future, which we'd like to avoid.

So, in brief, I wonder if it's possible to do for ResultSets what components do for Results, and if so how.

Thanks in advance,
-- 
Calle Dybedahl
calle at init.se -*- +46 703 - 970 612







More information about the DBIx-Class mailing list