ExtraConfigColumn Class — drizzle-orm Architecture
Architecture documentation for the ExtraConfigColumn class in common.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD a17b0aaa_22c4_d341_61c7_626b08bc7817["ExtraConfigColumn"] f4f42b4c_8610_03dd_fe01_232098668127["common.ts"] a17b0aaa_22c4_d341_61c7_626b08bc7817 -->|defined in| f4f42b4c_8610_03dd_fe01_232098668127 69e04b7a_8f84_1af0_8d9c_2b5869f5728d["getSQLType()"] a17b0aaa_22c4_d341_61c7_626b08bc7817 -->|method| 69e04b7a_8f84_1af0_8d9c_2b5869f5728d 8835d22d_fc5b_23a1_98c8_4e8f8397dfc9["asc()"] a17b0aaa_22c4_d341_61c7_626b08bc7817 -->|method| 8835d22d_fc5b_23a1_98c8_4e8f8397dfc9 792fac57_cf91_933d_a495_0e32d6068e85["desc()"] a17b0aaa_22c4_d341_61c7_626b08bc7817 -->|method| 792fac57_cf91_933d_a495_0e32d6068e85 2b226e9c_d961_6781_3213_e91784d29a82["nullsFirst()"] a17b0aaa_22c4_d341_61c7_626b08bc7817 -->|method| 2b226e9c_d961_6781_3213_e91784d29a82 b42f96eb_6df9_bd97_a521_b53ed88d1c1e["nullsLast()"] a17b0aaa_22c4_d341_61c7_626b08bc7817 -->|method| b42f96eb_6df9_bd97_a521_b53ed88d1c1e fddfc718_71d4_303d_c886_b130ee68540c["op()"] a17b0aaa_22c4_d341_61c7_626b08bc7817 -->|method| fddfc718_71d4_303d_c886_b130ee68540c
Relationship Graph
Source Code
drizzle-orm/src/pg-core/columns/common.ts lines 156–229
export class ExtraConfigColumn<
T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>,
> extends PgColumn<T, IndexedExtraConfigType> {
static override readonly [entityKind]: string = 'ExtraConfigColumn';
override getSQLType(): string {
return this.getSQLType();
}
indexConfig: IndexedExtraConfigType = {
order: this.config.order ?? 'asc',
nulls: this.config.nulls ?? 'last',
opClass: this.config.opClass,
};
defaultConfig: IndexedExtraConfigType = {
order: 'asc',
nulls: 'last',
opClass: undefined,
};
asc(): Omit<this, 'asc' | 'desc'> {
this.indexConfig.order = 'asc';
return this;
}
desc(): Omit<this, 'asc' | 'desc'> {
this.indexConfig.order = 'desc';
return this;
}
nullsFirst(): Omit<this, 'nullsFirst' | 'nullsLast'> {
this.indexConfig.nulls = 'first';
return this;
}
nullsLast(): Omit<this, 'nullsFirst' | 'nullsLast'> {
this.indexConfig.nulls = 'last';
return this;
}
/**
* ### PostgreSQL documentation quote
*
* > An operator class with optional parameters can be specified for each column of an index.
* The operator class identifies the operators to be used by the index for that column.
* For example, a B-tree index on four-byte integers would use the int4_ops class;
* this operator class includes comparison functions for four-byte integers.
* In practice the default operator class for the column's data type is usually sufficient.
* The main point of having operator classes is that for some data types, there could be more than one meaningful ordering.
* For example, we might want to sort a complex-number data type either by absolute value or by real part.
* We could do this by defining two operator classes for the data type and then selecting the proper class when creating an index.
* More information about operator classes check:
*
* ### Useful links
* https://www.postgresql.org/docs/current/sql-createindex.html
*
* https://www.postgresql.org/docs/current/indexes-opclass.html
*
* https://www.postgresql.org/docs/current/xindex.html
*
* ### Additional types
* If you have the `pg_vector` extension installed in your database, you can use the
* `vector_l2_ops`, `vector_ip_ops`, `vector_cosine_ops`, `vector_l1_ops`, `bit_hamming_ops`, `bit_jaccard_ops`, `halfvec_l2_ops`, `sparsevec_l2_ops` options, which are predefined types.
*
* **You can always specify any string you want in the operator class, in case Drizzle doesn't have it natively in its types**
*
* @param opClass
* @returns
*/
op(opClass: PgIndexOpClass): Omit<this, 'op'> {
this.indexConfig.opClass = opClass;
return this;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the ExtraConfigColumn class?
ExtraConfigColumn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/columns/common.ts.
Where is ExtraConfigColumn defined?
ExtraConfigColumn is defined in drizzle-orm/src/pg-core/columns/common.ts at line 156.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free