Skip to content

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

Open
@fschoell

Description

@fschoell

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions