Home / Class/ SQLiteBlobJson Class — drizzle-orm Architecture

SQLiteBlobJson Class — drizzle-orm Architecture

Architecture documentation for the SQLiteBlobJson class in blob.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  51a5cec8_0cb5_edac_492a_2cac72b8b1a0["SQLiteBlobJson"]
  5c8a5ab6_4356_4d2f_782b_4e0b3b38b801["blob.ts"]
  51a5cec8_0cb5_edac_492a_2cac72b8b1a0 -->|defined in| 5c8a5ab6_4356_4d2f_782b_4e0b3b38b801
  ef664e50_5e29_a12a_43a0_3eb25eb221c7["getSQLType()"]
  51a5cec8_0cb5_edac_492a_2cac72b8b1a0 -->|method| ef664e50_5e29_a12a_43a0_3eb25eb221c7
  dd41aed8_f97e_13f8_8b52_c3a757f0c931["mapFromDriverValue()"]
  51a5cec8_0cb5_edac_492a_2cac72b8b1a0 -->|method| dd41aed8_f97e_13f8_8b52_c3a757f0c931
  a13780dc_1713_44fc_4f18_1758323c0bae["mapToDriverValue()"]
  51a5cec8_0cb5_edac_492a_2cac72b8b1a0 -->|method| a13780dc_1713_44fc_4f18_1758323c0bae

Relationship Graph

Source Code

drizzle-orm/src/sqlite-core/columns/blob.ts lines 93–119

export class SQLiteBlobJson<T extends ColumnBaseConfig<'json', 'SQLiteBlobJson'>> extends SQLiteColumn<T> {
	static override readonly [entityKind]: string = 'SQLiteBlobJson';

	getSQLType(): string {
		return 'blob';
	}

	override mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): T['data'] {
		if (typeof Buffer !== 'undefined' && Buffer.from) {
			const buf = Buffer.isBuffer(value)
				? value
				// eslint-disable-next-line no-instanceof/no-instanceof
				: value instanceof ArrayBuffer
				? Buffer.from(value)
				: value.buffer
				? Buffer.from(value.buffer, value.byteOffset, value.byteLength)
				: Buffer.from(value);
			return JSON.parse(buf.toString('utf8'));
		}

		return JSON.parse(textDecoder!.decode(value));
	}

	override mapToDriverValue(value: T['data']): Buffer {
		return Buffer.from(JSON.stringify(value));
	}
}

Domain

Frequently Asked Questions

What is the SQLiteBlobJson class?
SQLiteBlobJson is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/columns/blob.ts.
Where is SQLiteBlobJson defined?
SQLiteBlobJson is defined in drizzle-orm/src/sqlite-core/columns/blob.ts at line 93.

Analyze Your Own Codebase

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

Try Supermodel Free