bun.XXXQuery types should implement an interface and take a generic Query object, like go-pg did.
jeffreydwalter opened this issue · comments
I have some go-pg code that I can't replicate because there's no functional equivalent to orm.Query. It would be nice if there was a query object interface, like there was in go-pg.
This for instance, is pretty unfortunate.
func (q *SelectQuery) Apply(fn func(*SelectQuery) *SelectQuery) *SelectQuery {
func (q *DeleteQuery) Apply(fn func(*DeleteQuery) *DeleteQuery) *DeleteQuery {
func (q *UpdateQuery) Apply(fn func(*UpdateQuery) *UpdateQuery) *UpdateQuery {
func (q *MergeQuery) Apply(fn func(*MergeQuery) *MergeQuery) *MergeQuery {
func (q *DropColumnQuery) Apply(fn func(*DropColumnQuery) *DropColumnQuery) *DropColumnQuery {
It would be MUCH more usable if there was just a:
func (q *Query) Apply(fn func(*Query) *Query) *Query {
like there was in go-pg.
There is QueryBuilder
interface and that's it. We can't have Apply(fn func(*Query) *Query) *Query
since there is no a single Query
struct any more.