Skip to content
New issue

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

qm.OrIn removes a custom closing parenthesis when passing in an empty array #1283

Open
fschoell opened this issue Jun 14, 2023 · 0 comments
Open

Comments

@fschoell
Copy link

When using qm.OrIn and passing in an empty array custom closing parentheses are being removed.

See this example code:

	inIds1 := []interface{}{1, 2}
	inIds2 := []interface{}{}

	dao.Users(
		qm.WhereIn("(id IN ?", inIds1...),
		qm.OrIn("id in ?)", inIds2...),
	).AllP(ctx, u.dbPool.MustGetConnection())

Resulting query (note the missing closing parenthesis after (1=0)):

SELECT `users`.* FROM `users` WHERE ((id IN (?,?)) OR (1=0) AND (`users`.`deleted_at` is null);

Expected query:

SELECT `users`.* FROM `users` WHERE ((id IN (?,?)) OR (1=0)) AND (`users`.`deleted_at` is null);

What version of SQLBoiler are you using (sqlboiler --version)?

SQLBoiler v4.14.2

What is your database and version (eg. Postgresql 10)

MariaDB 10.5.8

If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)

If this happened at runtime what code produced the issue? (if not applicable leave blank)

see above

What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)

Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)

Further information. What did you do, what did you expect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants