Skip to content

How to create dynamic WHERE clause #14

@PepijnK

Description

@PepijnK

Hi,

Is there support for dynamic where clauses? I could not find any documentation about how to do that. In my case I need to add AND'd conditions with nested OR conditions conditionally, to get something like:
WHERE x=? AND (foo>=? OR bar> ?) AND (bar> ?)

I've tried to create an []sq.Sqlizer and add the OR-expressions in there, then feed that to SelectBuilder.Where() but it fails with the message

converting Exec argument # 1's type: unsupported type []sqrl.Sqlizer, a slice

Ideally there is some kind of ConditionBuilder for this I guess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions