Skip to content

Proposal to implement OR operation #66

@eznix86

Description

@eznix86

Currently, keys are extracted from the where statement which intrinsically creates an AND statement.

To prevent breaking changes, the current behaviour will stay the same, but we can consider to have custom operators to extend the where functionally.

Introducing $ operators.

Theses operators can extend the functionally within where clause.

Example:

qb.query({
  columns: 'id, name, status',
  where: {
    status: { equals: 'finished' },
    $or: [
      { name: { equals: 'Alice' } },
      { city: { equals: 'New York' } }
    ]
  }
})

This will be parsed to become:

Note

Between status and $or, the operation AND stays applicable.
Example below:

select id,name,status from users where status AND ( name = "alice" OR city = "New York" )

This can resolve #43

This can open opportunity to $and

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