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

intervalStrToObj() — drizzle-orm Function Reference

Architecture documentation for the intervalStrToObj() function in introspect-pg.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  2f4aa935_6b40_9800_36ce_3a493020dba3["intervalStrToObj()"]
  71516551_23e3_bf30_27c9_000fb046ef71["introspect-pg.ts"]
  2f4aa935_6b40_9800_36ce_3a493020dba3 -->|defined in| 71516551_23e3_bf30_27c9_000fb046ef71
  0ac6ca12_fe1f_7133_5329_f66feb39896f["intervalConfig()"]
  0ac6ca12_fe1f_7133_5329_f66feb39896f -->|calls| 2f4aa935_6b40_9800_36ce_3a493020dba3
  style 2f4aa935_6b40_9800_36ce_3a493020dba3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/introspect-pg.ts lines 104–128

const intervalStrToObj = (str: string) => {
	if (str.startsWith('interval(')) {
		return {
			precision: Number(str.substring('interval('.length, str.length - 1)),
		};
	}
	const splitted = str.split(' ');
	if (splitted.length === 1) {
		return {};
	}
	const rest = splitted.slice(1, splitted.length).join(' ');
	if (possibleIntervals.includes(rest)) {
		return { fields: `"${rest}"` };
	}

	for (const s of possibleIntervals) {
		if (rest.startsWith(`${s}(`)) {
			return {
				fields: `"${s}"`,
				precision: Number(rest.substring(s.length + 1, rest.length - 1)),
			};
		}
	}
	return {};
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does intervalStrToObj() do?
intervalStrToObj() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/introspect-pg.ts.
Where is intervalStrToObj() defined?
intervalStrToObj() is defined in drizzle-kit/src/introspect-pg.ts at line 104.
What calls intervalStrToObj()?
intervalStrToObj() is called by 1 function(s): intervalConfig.

Analyze Your Own Codebase

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

Try Supermodel Free