with() — drizzle-orm Function Reference
Architecture documentation for the with() function in query-builder.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD c9dd732c_7680_4ea5_c7ba_53b02f73357a["with()"] 9e7877a8_9c04_8c04_0ea7_d880ebdc47af["QueryBuilder"] c9dd732c_7680_4ea5_c7ba_53b02f73357a -->|defined in| 9e7877a8_9c04_8c04_0ea7_d880ebdc47af f37e4da7_e330_997a_e3de_843ea11fb8ff["select()"] c9dd732c_7680_4ea5_c7ba_53b02f73357a -->|calls| f37e4da7_e330_997a_e3de_843ea11fb8ff 21e69e01_5eaf_40a7_24f2_de95f888f5cc["getDialect()"] c9dd732c_7680_4ea5_c7ba_53b02f73357a -->|calls| 21e69e01_5eaf_40a7_24f2_de95f888f5cc 88a1564b_f138_6d8b_6ea2_471c30fda660["selectDistinct()"] c9dd732c_7680_4ea5_c7ba_53b02f73357a -->|calls| 88a1564b_f138_6d8b_6ea2_471c30fda660 style c9dd732c_7680_4ea5_c7ba_53b02f73357a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/sqlite-core/query-builders/query-builder.ts lines 48–83
with(...queries: WithSubquery[]) {
const self = this;
function select(): SQLiteSelectBuilder<undefined, 'sync', void, 'qb'>;
function select<TSelection extends SelectedFields>(
fields: TSelection,
): SQLiteSelectBuilder<TSelection, 'sync', void, 'qb'>;
function select<TSelection extends SelectedFields>(
fields?: TSelection,
): SQLiteSelectBuilder<TSelection | undefined, 'sync', void, 'qb'> {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: undefined,
dialect: self.getDialect(),
withList: queries,
});
}
function selectDistinct(): SQLiteSelectBuilder<undefined, 'sync', void, 'qb'>;
function selectDistinct<TSelection extends SelectedFields>(
fields: TSelection,
): SQLiteSelectBuilder<TSelection, 'sync', void, 'qb'>;
function selectDistinct<TSelection extends SelectedFields>(
fields?: TSelection,
): SQLiteSelectBuilder<TSelection | undefined, 'sync', void, 'qb'> {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: undefined,
dialect: self.getDialect(),
withList: queries,
distinct: true,
});
}
return { select, selectDistinct };
}
Domain
Subdomains
Source
Frequently Asked Questions
What does with() do?
with() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/query-builders/query-builder.ts.
Where is with() defined?
with() is defined in drizzle-orm/src/sqlite-core/query-builders/query-builder.ts at line 48.
What does with() call?
with() calls 3 function(s): getDialect, select, selectDistinct.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free