Home / Class/ GelExtraConfigColumn Class — drizzle-orm Architecture

GelExtraConfigColumn Class — drizzle-orm Architecture

Architecture documentation for the GelExtraConfigColumn class in common.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5["GelExtraConfigColumn"]
  a74dd48d_d5e3_6bb4_19c7_1954c9126816["common.ts"]
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5 -->|defined in| a74dd48d_d5e3_6bb4_19c7_1954c9126816
  5b733440_389e_8f93_010a_7eb98a40aabb["getSQLType()"]
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5 -->|method| 5b733440_389e_8f93_010a_7eb98a40aabb
  ef97cdba_554d_deeb_396b_72c657a00e54["asc()"]
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5 -->|method| ef97cdba_554d_deeb_396b_72c657a00e54
  6aa1a44d_eac0_2a3a_4c55_5437f760560a["desc()"]
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5 -->|method| 6aa1a44d_eac0_2a3a_4c55_5437f760560a
  3e09f31e_54be_6d34_a10b_22423407eddc["nullsFirst()"]
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5 -->|method| 3e09f31e_54be_6d34_a10b_22423407eddc
  c7134b96_ced0_6f92_559f_65a9c23b311a["nullsLast()"]
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5 -->|method| c7134b96_ced0_6f92_559f_65a9c23b311a
  17454da8_8537_127c_2149_d447c751b950["op()"]
  37901e55_fe73_2894_3f57_6bb9ed1e3cb5 -->|method| 17454da8_8537_127c_2149_d447c751b950

Relationship Graph

Source Code

drizzle-orm/src/gel-core/columns/common.ts lines 155–228

export class GelExtraConfigColumn<
	T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>,
> extends GelColumn<T, IndexedExtraConfigType> {
	static override readonly [entityKind]: string = 'GelExtraConfigColumn';

	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 `Gel_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: GelIndexOpClass): Omit<this, 'op'> {
		this.indexConfig.opClass = opClass;
		return this;
	}
}

Domain

Frequently Asked Questions

What is the GelExtraConfigColumn class?
GelExtraConfigColumn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/columns/common.ts.
Where is GelExtraConfigColumn defined?
GelExtraConfigColumn is defined in drizzle-orm/src/gel-core/columns/common.ts at line 155.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free