Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added from() to all inline examples #507

Merged
merged 3 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions drizzle-orm/src/sql/expressions/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function bindIfParam(value: unknown, column: AnyColumn | SQL.Aliased): SQ
*
* ```ts
* // Select cars made by Ford
* db.select(cars)
* db.select().from(cars)
* .where(eq(cars.make, 'Ford'))
* ```
*
Expand Down Expand Up @@ -67,7 +67,7 @@ export function eq(
*
* ```ts
* // Select cars not made by Ford
* db.select(cars)
* db.select().from(cars)
* .where(ne(cars.make, 'Ford'))
* ```
*
Expand Down Expand Up @@ -95,7 +95,7 @@ export function ne(
* ## Examples
*
* ```ts
* db.select(cars)
* db.select().from(cars)
* .where(
* and(
* eq(cars.make, 'Volvo'),
Expand Down Expand Up @@ -132,7 +132,7 @@ export function and(...conditions: (SQL | undefined)[]): SQL | undefined {
* ## Examples
*
* ```ts
* db.select(cars)
* db.select().from(cars)
* .where(
* or(
* eq(cars.make, 'GM'),
Expand Down Expand Up @@ -169,7 +169,7 @@ export function or(...conditions: (SQL | undefined)[]): SQL | undefined {
*
* ```ts
* // Select cars _not_ made by GM or Ford.
* db.select(cars)
* db.select().from(cars)
* .where(not(inArray(cars.make, ['GM', 'Ford'])))
* ```
*/
Expand All @@ -185,7 +185,7 @@ export function not(condition: SQL): SQL {
*
* ```ts
* // Select cars made after 2000.
* db.select(cars)
* db.select().from(cars)
* .where(gt(cars.year, 2000))
* ```
*
Expand Down Expand Up @@ -216,7 +216,7 @@ export function gt(
*
* ```ts
* // Select cars made on or after 2000.
* db.select(cars)
* db.select().from(cars)
* .where(gte(cars.year, 2000))
* ```
*
Expand Down Expand Up @@ -245,7 +245,7 @@ export function gte(
*
* ```ts
* // Select cars made before 2000.
* db.select(cars)
* db.select().from(cars)
* .where(lt(cars.year, 2000))
* ```
*
Expand Down Expand Up @@ -274,7 +274,7 @@ export function lt(
*
* ```ts
* // Select cars made before 2000.
* db.select(cars)
* db.select().from(cars)
* .where(lte(cars.year, 2000))
* ```
*
Expand Down Expand Up @@ -308,7 +308,7 @@ export function lte(
*
* ```ts
* // Select cars made by Ford or GM.
* db.select(cars)
* db.select().from(cars)
* .where(inArray(cars.make, ['Ford', 'GM']))
* ```
*
Expand Down Expand Up @@ -350,7 +350,7 @@ export function inArray(
*
* ```ts
* // Select cars made by any company except Ford or GM.
* db.select(cars)
* db.select().from(cars)
* .where(notInArray(cars.make, ['Ford', 'GM']))
* ```
*
Expand Down Expand Up @@ -392,7 +392,7 @@ export function notInArray(
*
* ```ts
* // Select cars that have no discontinuedAt date.
* db.select(cars)
* db.select().from(cars)
* .where(isNull(cars.discontinuedAt))
* ```
*
Expand All @@ -412,7 +412,7 @@ export function isNull(column: AnyColumn | Placeholder | SQLWrapper): SQL {
*
* ```ts
* // Select cars that have been discontinued.
* db.select(cars)
* db.select().from(cars)
* .where(isNotNull(cars.discontinuedAt))
* ```
*
Expand Down Expand Up @@ -484,7 +484,7 @@ export function notExists(subquery: SQLWrapper): SQL {
*
* ```ts
* // Select cars made between 1990 and 2000
* db.select(cars)
* db.select().from(cars)
* .where(between(cars.year, 1990, 2000))
* ```
*
Expand Down Expand Up @@ -519,7 +519,7 @@ export function between(
*
* ```ts
* // Exclude cars made in the 1970s
* db.select(cars)
* db.select().from(cars)
* .where(notBetween(cars.year, 1970, 1979))
* ```
*
Expand Down Expand Up @@ -553,7 +553,7 @@ export function notBetween(
*
* ```ts
* // Select all cars with 'Turbo' in their names.
* db.select(cars)
* db.select().from(cars)
* .where(like(cars.name, '%Turbo%'))
* ```
*
Expand All @@ -574,7 +574,7 @@ export function like(column: AnyColumn, value: string | Placeholder | SQLWrapper
*
* ```ts
* // Select all cars that don't have "ROver" in their name.
* db.select(cars)
* db.select().from(cars)
* .where(notLike(cars.name, '%Rover%'))
* ```
*
Expand All @@ -598,7 +598,7 @@ export function notLike(column: AnyColumn, value: string | Placeholder | SQLWrap
*
* ```ts
* // Select all cars with 'Turbo' in their names.
* db.select(cars)
* db.select().from(cars)
* .where(ilike(cars.name, '%Turbo%'))
* ```
*
Expand All @@ -619,7 +619,7 @@ export function ilike(column: AnyColumn, value: string | Placeholder | SQLWrappe
*
* ```ts
* // Select all cars that don't have "Rover" in their name.
* db.select(cars)
* db.select().from(cars)
* .where(notLike(cars.name, '%Rover%'))
* ```
*
Expand Down
4 changes: 2 additions & 2 deletions drizzle-orm/src/sql/expressions/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { sql } from '..';
* ```ts
* // Return cars, starting with the oldest models
* // and going in ascending order to the newest.
* db.select(cars)
* db.select().from(cars)
* .orderBy(asc(cars.year));
* ```
*
Expand All @@ -35,7 +35,7 @@ export function asc(column: AnyColumn | SQLWrapper): SQL {
* ```ts
* // Select users, with the most recently created
* // records coming first.
* db.select(users)
* db.select().from(users)
* .orderBy(desc(users.createdAt));
* ```
*
Expand Down