Home / Function/ fromJson() — drizzle-orm Function Reference

fromJson() — drizzle-orm Function Reference

Architecture documentation for the fromJson() function in sqlgenerator.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  f532f7a9_3781_5a3c_9695_e62bd56cabd7["fromJson()"]
  fe4174c7_3b9c_5b26_98a0_b2395ca21939["sqlgenerator.ts"]
  f532f7a9_3781_5a3c_9695_e62bd56cabd7 -->|defined in| fe4174c7_3b9c_5b26_98a0_b2395ca21939
  3fa496e9_2bff_7b59_f02a_4cc1a6cfcea7["libSqlLogSuggestionsAndReturn()"]
  3fa496e9_2bff_7b59_f02a_4cc1a6cfcea7 -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  99a768a1_158f_61ad_5701_374c946e2765["pgSuggestions()"]
  99a768a1_158f_61ad_5701_374c946e2765 -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  8ee7c845_c3a4_fbc5_6447_aab21a1f9ef1["mysqlPush()"]
  8ee7c845_c3a4_fbc5_6447_aab21a1f9ef1 -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  5e0b1139_8050_e207_b519_7736291ee6af["logSuggestionsAndReturn()"]
  5e0b1139_8050_e207_b519_7736291ee6af -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  c7a398db_43c9_7771_09b7_73bc09e703e8["applyPgSnapshotsDiff()"]
  c7a398db_43c9_7771_09b7_73bc09e703e8 -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  a5972ffc_ff1b_9523_2495_5373af710e65["applyMysqlSnapshotsDiff()"]
  a5972ffc_ff1b_9523_2495_5373af710e65 -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  d4992b27_bf78_8099_5134_750cef1c518c["applySingleStoreSnapshotsDiff()"]
  d4992b27_bf78_8099_5134_750cef1c518c -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  d9097b7e_1e27_d29f_7732_f2fa1447f2b8["applySqliteSnapshotsDiff()"]
  d9097b7e_1e27_d29f_7732_f2fa1447f2b8 -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  55569cde_7638_9cfc_9dcd_34636d975ec3["applyLibSQLSnapshotsDiff()"]
  55569cde_7638_9cfc_9dcd_34636d975ec3 -->|calls| f532f7a9_3781_5a3c_9695_e62bd56cabd7
  style f532f7a9_3781_5a3c_9695_e62bd56cabd7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/sqlgenerator.ts lines 4122–4144

export function fromJson(
	statements: JsonStatement[],
	dialect: Dialect,
	action?: 'push',
	json2?: SQLiteSchemaSquashed,
) {
	const result = statements
		.flatMap((statement) => {
			const filtered = convertors.filter((it) => {
				return it.can(statement, dialect);
			});

			const convertor = filtered.length === 1 ? filtered[0] : undefined;

			if (!convertor) {
				return '';
			}

			return convertor.convert(statement, json2, action);
		})
		.filter((it) => it !== '');
	return result;
}

Domain

Subdomains

Frequently Asked Questions

What does fromJson() do?
fromJson() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/sqlgenerator.ts.
Where is fromJson() defined?
fromJson() is defined in drizzle-kit/src/sqlgenerator.ts at line 4122.
What calls fromJson()?
fromJson() is called by 9 function(s): applyLibSQLSnapshotsDiff, applyMysqlSnapshotsDiff, applyPgSnapshotsDiff, applySingleStoreSnapshotsDiff, applySqliteSnapshotsDiff, libSqlLogSuggestionsAndReturn, logSuggestionsAndReturn, mysqlPush, and 1 more.

Analyze Your Own Codebase

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

Try Supermodel Free