IndexBuilderOn Class — drizzle-orm Architecture
Architecture documentation for the IndexBuilderOn class in indexes.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 02429881_d882_e62b_a969_f07e1c11f572["IndexBuilderOn"] 8e96cfe7_b09e_acd6_1e9a_cf73dc90a16f["indexes.ts"] 02429881_d882_e62b_a969_f07e1c11f572 -->|defined in| 8e96cfe7_b09e_acd6_1e9a_cf73dc90a16f 6875ccf4_ca78_c367_0fb9_9062d8cfaee1["constructor()"] 02429881_d882_e62b_a969_f07e1c11f572 -->|method| 6875ccf4_ca78_c367_0fb9_9062d8cfaee1 d887a4a7_072c_ecf4_9735_b7a9c3882c23["on()"] 02429881_d882_e62b_a969_f07e1c11f572 -->|method| d887a4a7_072c_ecf4_9735_b7a9c3882c23 b22e4141_d0f5_81e4_6c4c_8be1c3c98464["onOnly()"] 02429881_d882_e62b_a969_f07e1c11f572 -->|method| b22e4141_d0f5_81e4_6c4c_8be1c3c98464 af5f6a90_6806_7ea0_f1b7_b4919c5aad79["using()"] 02429881_d882_e62b_a969_f07e1c11f572 -->|method| af5f6a90_6806_7ea0_f1b7_b4919c5aad79
Relationship Graph
Source Code
drizzle-orm/src/gel-core/indexes.ts lines 117–187
export class IndexBuilderOn {
static readonly [entityKind]: string = 'GelIndexBuilderOn';
constructor(private unique: boolean, private name?: string) {}
on(...columns: [Partial<GelExtraConfigColumn> | SQL, ...Partial<GelExtraConfigColumn | SQL>[]]): IndexBuilder {
return new IndexBuilder(
columns.map((it) => {
if (is(it, SQL)) {
return it;
}
it = it as GelExtraConfigColumn;
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType!, it.indexConfig!);
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
return clonedIndexedColumn;
}),
this.unique,
false,
this.name,
);
}
onOnly(...columns: [Partial<GelExtraConfigColumn | SQL>, ...Partial<GelExtraConfigColumn | SQL>[]]): IndexBuilder {
return new IndexBuilder(
columns.map((it) => {
if (is(it, SQL)) {
return it;
}
it = it as GelExtraConfigColumn;
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType!, it.indexConfig!);
it.indexConfig = it.defaultConfig;
return clonedIndexedColumn;
}),
this.unique,
true,
this.name,
);
}
/**
* Specify what index method to use. Choices are `btree`, `hash`, `gist`, `sGelist`, `gin`, `brin`, or user-installed access methods like `bloom`. The default method is `btree.
*
* If you have the `Gel_vector` extension installed in your database, you can use the `hnsw` and `ivfflat` options, which are predefined types.
*
* **You can always specify any string you want in the method, in case Drizzle doesn't have it natively in its types**
*
* @param method The name of the index method to be used
* @param columns
* @returns
*/
using(
method: GelIndexMethod,
...columns: [Partial<GelExtraConfigColumn | SQL>, ...Partial<GelExtraConfigColumn | SQL>[]]
): IndexBuilder {
return new IndexBuilder(
columns.map((it) => {
if (is(it, SQL)) {
return it;
}
it = it as GelExtraConfigColumn;
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType!, it.indexConfig!);
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
return clonedIndexedColumn;
}),
this.unique,
true,
this.name,
method,
);
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the IndexBuilderOn class?
IndexBuilderOn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/indexes.ts.
Where is IndexBuilderOn defined?
IndexBuilderOn is defined in drizzle-orm/src/gel-core/indexes.ts at line 117.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free