I'm currently using Slick codegen (version 3.2.0-M1) to generate Slick code for a database. Many of my tables contain the same columns (with the same name and type), and so I would like to have some methods that can perform operations on these tables in a generic way, e.g., a generic method that can select rows from any of these tables based on a particular shared field.
To do this, I could create a trait that would contain these shared fields and then have the Slick table classes extend them or mix them in. Ideally, I'd like to have the code generator add extends <trait>
or with <trait>
to these classes for me.
I see that there's an overrideable code
method in the generator, but I would like to avoid having to mess with the code directly, e.g. via regular expressions.
I haven't found anything online or in the Slick documentation that points towards an easy solution using code generator customization, so I was wondering if anyone out there knows if this is even possible.