import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.4/deps.ts";
const { ExpressionWrapper } = kysely;
Combines this
and another expression using OR
.
Also see {@link ExpressionBuilder.or}
Examples
db.selectFrom('person')
.selectAll()
.where(eb => eb('first_name', '=', 'Jennifer')
.or('first_name', '=', 'Arnold')
.or('first_name', '=', 'Sylvester')
)
The generated SQL (PostgreSQL):
select *
from "person"
where (
"first_name" = $1
or "first_name" = $2
or "first_name" = $3
)
You can also pass any expression as the only argument to this method:
db.selectFrom('person')
.selectAll()
.where(eb => eb('first_name', '=', 'Jennifer')
.or(eb('first_name', '=', 'Sylvester').and('last_name', '=', 'Stallone'))
.or(eb.exists(
eb.selectFrom('pet')
.select('id')
.whereRef('pet.owner_id', '=', 'person.id')
)
)
The generated SQL (PostgreSQL):
select *
from "person"
where (
"first_name" = $1
or ("first_name" = $2 and "last_name" = $3)
or exists (
select "id"
from "pet"
where "pet"."owner_id" = "person"."id"
)
)
Type Parameters
RE extends ReferenceExpression<DB, TB>
VE extends OperandValueExpressionOrList<DB, TB, RE>
Type Parameters
E extends OperandExpression<SqlBool>
Parameters
expression: E