sqrl icon indicating copy to clipboard operation
sqrl copied to clipboard

Enable placeholders support in all query builder methods

Open vearutop opened this issue 8 years ago • 7 comments

Currently only Where method accepts args as placeholder values

func (b *SelectBuilder) Where(pred interface{}, args ...interface{}) *SelectBuilder {
    b.whereParts = append(b.whereParts, newWherePart(pred, args...))
    return b
}

Other methods like GroupBy can not accept placeholdered data

// GroupBy adds GROUP BY expressions to the query.
func (b *SelectBuilder) GroupBy(groupBys ...string) *SelectBuilder {
    b.groupBys = append(b.groupBys, groupBys...)
    return b
}

Please add placeholders support to these methods to provide means for building rich SQL statements.

vearutop avatar Apr 04 '16 01:04 vearutop

Can you list all methods that need it? I will try to implement it.

shaxbee avatar Oct 14 '16 03:10 shaxbee

I'm also desperately in need of args support in GROUP BY and ORDER statements

bbrodriges avatar Apr 20 '17 09:04 bbrodriges

I'll look into that :-)

On Thu, Apr 20, 2017, 5:23 PM bbrodriges [email protected] wrote:

I'm also desperately in need of args support in GROUP BY and ORDER statements

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elgris/sqrl/issues/1#issuecomment-295648788, or mute the thread https://github.com/notifications/unsubscribe-auth/AE_mfVka4ne-Fe9A6y5H9wKfK6MbT309ks5rxyQsgaJpZM4H-vC5 .

shaxbee avatar May 04 '17 13:05 shaxbee

@bbrodriges @vearutop How do you see placeholders usage? It would be nice if you provide a couple of examples.

From my point of view GROUP BY clause (for instance) receives a list of columns and additional options (like ASC or DESC). And those can be passed as strings.

elgris avatar May 14 '17 16:05 elgris

Group by is often used with aggregate functions.

On Mon, May 15, 2017, 12:55 AM Ivan Kirichenko [email protected] wrote:

@bbrodriges https://github.com/bbrodriges @vearutop https://github.com/vearutop How do you see placeholders usage? It would be nice if you provide a couple of examples.

From my point of view GROUP BY clause (for instance) receives a list of columns and additional options (like ASC or DESC). And those can be passed as strings.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elgris/sqrl/issues/1#issuecomment-301325125, or mute the thread https://github.com/notifications/unsubscribe-auth/AE_mfWM9ykhLK7ki8rEPxcFhShUu4XXJks5r5zIDgaJpZM4H-vC5 .

shaxbee avatar May 14 '17 16:05 shaxbee

How about the FROM clause? E.g. when using derived tables (subqueries in the FROM clause)

michael2m avatar Sep 06 '17 12:09 michael2m

Missing placeholders' support for FROM clause.

Scukerman avatar Jul 19 '18 07:07 Scukerman