Home / File/ options.ts — drizzle-orm Source File

options.ts — drizzle-orm Source File

Architecture documentation for options.ts, a typescript file in the drizzle-orm codebase. 1 imports, 3 dependents.

File typescript DrizzleORM DatabaseDrivers 1 imports 3 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  73e2aa44_a4c6_8ec0_4c1d_1b146021dedc["options.ts"]
  02888e0e_5ac9_200a_278f_c729b5af7410["utils"]
  73e2aa44_a4c6_8ec0_4c1d_1b146021dedc --> 02888e0e_5ac9_200a_278f_c729b5af7410
  f0c93e37_d0c6_85de_9c85_875c07d8cd5b["enforce-delete-with-where.ts"]
  f0c93e37_d0c6_85de_9c85_875c07d8cd5b --> 73e2aa44_a4c6_8ec0_4c1d_1b146021dedc
  293f011b_cdb8_71ff_a37a_bbe21603eeb7["enforce-update-with-where.ts"]
  293f011b_cdb8_71ff_a37a_bbe21603eeb7 --> 73e2aa44_a4c6_8ec0_4c1d_1b146021dedc
  ccb38674_a025_897a_eb29_bdfa2dbe01c1["index.ts"]
  ccb38674_a025_897a_eb29_bdfa2dbe01c1 --> 73e2aa44_a4c6_8ec0_4c1d_1b146021dedc
  style 73e2aa44_a4c6_8ec0_4c1d_1b146021dedc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { TSESTree } from '@typescript-eslint/utils';

export type Options = readonly [{
	drizzleObjectName: string[] | string;
}];

const isDrizzleObjName = (name: string, drizzleObjectName: string[] | string) => {
	if (typeof drizzleObjectName === 'string') {
		return name === drizzleObjectName;
	}

	if (Array.isArray(drizzleObjectName)) {
		if (drizzleObjectName.length === 0) {
			return true;
		}

		return drizzleObjectName.includes(name);
	}

	return false;
};

export const isDrizzleObj = (
	node: TSESTree.MemberExpression,
	options: Options,
) => {
	const drizzleObjectName = options[0].drizzleObjectName;

	if (node.object.type === 'Identifier') {
		return isDrizzleObjName(node.object.name, drizzleObjectName);
	} else if (node.object.type === 'MemberExpression' && node.object.property.type === 'Identifier') {
		return isDrizzleObjName(node.object.property.name, drizzleObjectName);
	} else if (node.object.type === 'CallExpression') {
		if (node.object.callee.type === 'Identifier') {
			return isDrizzleObjName(node.object.callee.name, drizzleObjectName);
		} else if (node.object.callee.type === 'MemberExpression' && node.object.callee.property.type === 'Identifier') {
			return isDrizzleObjName(node.object.callee.property.name, drizzleObjectName);
		}
	}

	return false;
};

Domain

Subdomains

Types

Dependencies

  • utils

Frequently Asked Questions

What does options.ts do?
options.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in options.ts?
options.ts defines 2 function(s): isDrizzleObj, isDrizzleObjName.
What does options.ts depend on?
options.ts imports 1 module(s): utils.
What files import options.ts?
options.ts is imported by 3 file(s): enforce-delete-with-where.ts, enforce-update-with-where.ts, index.ts.
Where is options.ts in the architecture?
options.ts is located at eslint-plugin-drizzle/src/utils/options.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, directory: eslint-plugin-drizzle/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free