Skip to content

Commit

Permalink
fix complex join example
Browse files Browse the repository at this point in the history
  • Loading branch information
koskimas committed Mar 22, 2024
1 parent e951eae commit 9f836c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion site/docs/examples/JOIN/0030-complex-join.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ export const complexJoin = `await db.selectFrom('person')
(join) => join
.onRef('pet.owner_id', '=', 'person.id')
.on('pet.name', '=', 'Doggo')
.on((eb) => eb.or([eb("person.age", ">", 18), eb("person.age", "<", 100)]))
.on((eb) => eb.or([
eb('person.age', '>', 18),
eb('person.age', '<', 100)
]))
)
.selectAll()
.execute()`
11 changes: 9 additions & 2 deletions src/query-builder/select-query-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,10 @@ export interface SelectQueryBuilder<DB, TB extends keyof DB, O>
* (join) => join
* .onRef('pet.owner_id', '=', 'person.id')
* .on('pet.name', '=', 'Doggo')
* .on((eb) => eb.or([eb("person.age", ">", 18), eb("person.age", "<", 100)]))
* .on((eb) => eb.or([
* eb('person.age', '>', 18),
* eb('person.age', '<', 100)
* ]))
* )
* .selectAll()
* .execute()
Expand All @@ -611,6 +614,10 @@ export interface SelectQueryBuilder<DB, TB extends keyof DB, O>
* inner join "pet"
* on "pet"."owner_id" = "person"."id"
* and "pet"."name" = $1
* and (
* "person"."age" > $2 OR
* "person"."age" < $3
* )
* ```
*
* <!-- siteExample("join", "Subquery join", 40) -->
Expand Down Expand Up @@ -2108,7 +2115,7 @@ class SelectQueryBuilderImpl<DB, TB extends keyof DB, O>
),
})
}

top(
expression: number | bigint,
modifiers?: TopModifier,
Expand Down

0 comments on commit 9f836c4

Please sign in to comment.