SQLiteSelectBase Class — drizzle-orm Architecture
Architecture documentation for the SQLiteSelectBase class in select.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD f6975f28_b9ca_b194_74b6_b905f6958ecc["SQLiteSelectBase"] 49cf912b_062f_f482_ab61_a2b8c881ec4d["select.ts"] f6975f28_b9ca_b194_74b6_b905f6958ecc -->|defined in| 49cf912b_062f_f482_ab61_a2b8c881ec4d ce393a11_d716_c5c2_b5a8_fb65fb3a0d76["_prepare()"] f6975f28_b9ca_b194_74b6_b905f6958ecc -->|method| ce393a11_d716_c5c2_b5a8_fb65fb3a0d76 82c509da_38d3_a72f_ac24_1cb2f0391413["$withCache()"] f6975f28_b9ca_b194_74b6_b905f6958ecc -->|method| 82c509da_38d3_a72f_ac24_1cb2f0391413 efa2117e_1596_2384_8be1_a62161654e89["prepare()"] f6975f28_b9ca_b194_74b6_b905f6958ecc -->|method| efa2117e_1596_2384_8be1_a62161654e89 876b6271_ba71_4559_1ec2_bd26586facf0["execute()"] f6975f28_b9ca_b194_74b6_b905f6958ecc -->|method| 876b6271_ba71_4559_1ec2_bd26586facf0
Relationship Graph
Source Code
drizzle-orm/src/sqlite-core/query-builders/select.ts lines 883–964
export class SQLiteSelectBase<
TTableName extends string | undefined,
TResultType extends 'sync' | 'async',
TRunResult,
TSelection,
TSelectMode extends SelectMode = 'single',
TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>
: {},
TDynamic extends boolean = false,
TExcludedMethods extends string = never,
TResult = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],
TSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,
> extends SQLiteSelectQueryBuilderBase<
SQLiteSelectHKT,
TTableName,
TResultType,
TRunResult,
TSelection,
TSelectMode,
TNullabilityMap,
TDynamic,
TExcludedMethods,
TResult,
TSelectedFields
> implements RunnableQuery<TResult, 'sqlite'>, SQLWrapper {
static override readonly [entityKind]: string = 'SQLiteSelect';
/** @internal */
_prepare(isOneTimeQuery = true): SQLiteSelectPrepare<this> {
if (!this.session) {
throw new Error('Cannot execute a query on a query builder. Please use a database instance instead.');
}
const fieldsList = orderSelectedFields<SQLiteColumn>(this.config.fields);
const query = this.session[isOneTimeQuery ? 'prepareOneTimeQuery' : 'prepareQuery'](
this.dialect.sqlToQuery(this.getSQL()),
fieldsList,
'all',
true,
undefined,
{
type: 'select',
tables: [...this.usedTables],
},
this.cacheConfig,
);
query.joinsNotNullableMap = this.joinsNotNullableMap;
return query as ReturnType<this['prepare']>;
}
$withCache(config?: { config?: CacheConfig; tag?: string; autoInvalidate?: boolean } | false) {
this.cacheConfig = config === undefined
? { config: {}, enable: true, autoInvalidate: true }
: config === false
? { enable: false }
: { enable: true, autoInvalidate: true, ...config };
return this;
}
prepare(): SQLiteSelectPrepare<this> {
return this._prepare(false);
}
run: ReturnType<this['prepare']>['run'] = (placeholderValues) => {
return this._prepare().run(placeholderValues);
};
all: ReturnType<this['prepare']>['all'] = (placeholderValues) => {
return this._prepare().all(placeholderValues);
};
get: ReturnType<this['prepare']>['get'] = (placeholderValues) => {
return this._prepare().get(placeholderValues);
};
values: ReturnType<this['prepare']>['values'] = (placeholderValues) => {
return this._prepare().values(placeholderValues);
};
async execute(): Promise<SQLiteSelectExecute<this>> {
return this.all() as SQLiteSelectExecute<this>;
}
Domain
Source
Frequently Asked Questions
What is the SQLiteSelectBase class?
SQLiteSelectBase is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/query-builders/select.ts.
Where is SQLiteSelectBase defined?
SQLiteSelectBase is defined in drizzle-orm/src/sqlite-core/query-builders/select.ts at line 883.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free