I would like to add generic template based filter functions to Columns, Tables, Indexes, and ForeignKeys. I find myself often wanting to filter these slices on one or more properties but I feel directly coding it each time I need a new filter will be cumbersome.
It would look something like:
func (c Columns) FilterT(t string) Columns {
//for column
//execute template t
//if result is truthy
//add to result
//return result
}
At this point, every user can define templates that render a truthy or falsey string. Then, they can easily filter in templates like this:
Feedback or alternative solutions are welcome. I don't love this implementation but I feel it is better than adding a bunch of custom filters to the code base every time we want something different.
I would like to add generic template based filter functions to
Columns
,Tables
,Indexes
, andForeignKeys
. I find myself often wanting to filter these slices on one or more properties but I feel directly coding it each time I need a new filter will be cumbersome.It would look something like:
At this point, every user can define templates that render a truthy or falsey string. Then, they can easily filter in templates like this:
Feedback or alternative solutions are welcome. I don't love this implementation but I feel it is better than adding a bunch of custom filters to the code base every time we want something different.