We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query := sq.sq.Select(`COALESCE(MAX(ID),0)`).From(`channel`) if len(name) != 0 { query = query.Where(sq.Eq{"name":name}) } if true { query = query.Where(sq.Eq{"active":active}) } // result // sql = SELECT COALESCE(MAX(ID),0) FROM channel WHERE name = ? // args = []interface{} & 0 = xxxx sql,args,err := query.ToSql() if err != nil { return err } err = sqlx.GetContext(ctx,&data,sql,args...) if err != nil{ // output // pq: syntax error at end of input }
The text was updated successfully, but these errors were encountered:
I checked the sql is correct, does anyone know why this is?
Sorry, something went wrong.
What sql engine are you using? ? syntax won't work on PostGreSQL.
?
It's also suspicious that I don't see a WHERE active = ? in the sql you're showing here.
WHERE active = ?
How did you check the sql is correct? Did you evaluate it directly against your database?
No branches or pull requests
The text was updated successfully, but these errors were encountered: