SQLiteSelectBuilder Class — drizzle-orm Architecture
Architecture documentation for the SQLiteSelectBuilder class in select.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 7fe0b35a_8afa_0082_ace8_8c071ed2ece2["SQLiteSelectBuilder"] 49cf912b_062f_f482_ab61_a2b8c881ec4d["select.ts"] 7fe0b35a_8afa_0082_ace8_8c071ed2ece2 -->|defined in| 49cf912b_062f_f482_ab61_a2b8c881ec4d 498dec18_4fdc_0bca_10b0_6ecbe4f68fa5["constructor()"] 7fe0b35a_8afa_0082_ace8_8c071ed2ece2 -->|method| 498dec18_4fdc_0bca_10b0_6ecbe4f68fa5 76d16d1f_865e_095a_721d_7abd001b2e98["from()"] 7fe0b35a_8afa_0082_ace8_8c071ed2ece2 -->|method| 76d16d1f_865e_095a_721d_7abd001b2e98
Relationship Graph
Source Code
drizzle-orm/src/sqlite-core/query-builders/select.ts lines 57–127
export class SQLiteSelectBuilder<
TSelection extends SelectedFields | undefined,
TResultType extends 'sync' | 'async',
TRunResult,
TBuilderMode extends 'db' | 'qb' = 'db',
> {
static readonly [entityKind]: string = 'SQLiteSelectBuilder';
private fields: TSelection;
private session: SQLiteSession<any, any, any, any> | undefined;
private dialect: SQLiteDialect;
private withList: Subquery[] | undefined;
private distinct: boolean | undefined;
constructor(
config: {
fields: TSelection;
session: SQLiteSession<any, any, any, any> | undefined;
dialect: SQLiteDialect;
withList?: Subquery[];
distinct?: boolean;
},
) {
this.fields = config.fields;
this.session = config.session;
this.dialect = config.dialect;
this.withList = config.withList;
this.distinct = config.distinct;
}
from<TFrom extends SQLiteTable | Subquery | SQLiteViewBase | SQL>(
source: TFrom,
): CreateSQLiteSelectFromBuilderMode<
TBuilderMode,
GetSelectTableName<TFrom>,
TResultType,
TRunResult,
TSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection,
TSelection extends undefined ? 'single' : 'partial'
> {
const isPartialSelect = !!this.fields;
let fields: SelectedFields;
if (this.fields) {
fields = this.fields;
} else if (is(source, Subquery)) {
// This is required to use the proxy handler to get the correct field values from the subquery
fields = Object.fromEntries(
Object.keys(source._.selectedFields).map((
key,
) => [key, source[key as unknown as keyof typeof source] as unknown as SelectedFields[string]]),
);
} else if (is(source, SQLiteViewBase)) {
fields = source[ViewBaseConfig].selectedFields as SelectedFields;
} else if (is(source, SQL)) {
fields = {};
} else {
fields = getTableColumns<SQLiteTable>(source);
}
return new SQLiteSelectBase({
table: source,
fields,
isPartialSelect,
session: this.session,
dialect: this.dialect,
withList: this.withList,
distinct: this.distinct,
}) as any;
}
}
Domain
Source
Frequently Asked Questions
What is the SQLiteSelectBuilder class?
SQLiteSelectBuilder is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/query-builders/select.ts.
Where is SQLiteSelectBuilder defined?
SQLiteSelectBuilder is defined in drizzle-orm/src/sqlite-core/query-builders/select.ts at line 57.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free