Home / Class/ SingleStoreDecimal Class — drizzle-orm Architecture

SingleStoreDecimal Class — drizzle-orm Architecture

Architecture documentation for the SingleStoreDecimal class in decimal.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  86d57bcd_49fe_ec90_09b5_3e1ee001e153["SingleStoreDecimal"]
  2a9ee6c3_f2e3_0561_6981_2f8d4be67f5f["decimal.ts"]
  86d57bcd_49fe_ec90_09b5_3e1ee001e153 -->|defined in| 2a9ee6c3_f2e3_0561_6981_2f8d4be67f5f
  d853f220_ed97_2335_2902_52cab53be6dc["mapFromDriverValue()"]
  86d57bcd_49fe_ec90_09b5_3e1ee001e153 -->|method| d853f220_ed97_2335_2902_52cab53be6dc
  5932fd6a_6afc_0e21_8fee_3c3ec75a21b0["getSQLType()"]
  86d57bcd_49fe_ec90_09b5_3e1ee001e153 -->|method| 5932fd6a_6afc_0e21_8fee_3c3ec75a21b0

Relationship Graph

Source Code

drizzle-orm/src/singlestore-core/columns/decimal.ts lines 41–69

export class SingleStoreDecimal<T extends ColumnBaseConfig<'string', 'SingleStoreDecimal'>>
	extends SingleStoreColumnWithAutoIncrement<T, SingleStoreDecimalConfig>
{
	static override readonly [entityKind]: string = 'SingleStoreDecimal';

	readonly precision: number | undefined = this.config.precision;
	readonly scale: number | undefined = this.config.scale;
	readonly unsigned: boolean | undefined = this.config.unsigned;

	override mapFromDriverValue(value: unknown): string {
		// For RQBv2
		if (typeof value === 'string') return value;

		return String(value);
	}

	getSQLType(): string {
		let type = '';
		if (this.precision !== undefined && this.scale !== undefined) {
			type += `decimal(${this.precision},${this.scale})`;
		} else if (this.precision === undefined) {
			type += 'decimal';
		} else {
			type += `decimal(${this.precision})`;
		}
		type = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;
		return this.unsigned ? `${type} unsigned` : type;
	}
}

Domain

Frequently Asked Questions

What is the SingleStoreDecimal class?
SingleStoreDecimal is a class in the drizzle-orm codebase, defined in drizzle-orm/src/singlestore-core/columns/decimal.ts.
Where is SingleStoreDecimal defined?
SingleStoreDecimal is defined in drizzle-orm/src/singlestore-core/columns/decimal.ts at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free