Home / Function/ generateTableType() — astro Function Reference

generateTableType() — astro Function Reference

Architecture documentation for the generateTableType() function in typegen.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0cdd3045_dd6d_ed9f_790e_b712c12c2645["generateTableType()"]
  cfd4bd09_8623_b9e9_1f9b_643824244dcb["typegen.ts"]
  0cdd3045_dd6d_ed9f_790e_b712c12c2645 -->|defined in| cfd4bd09_8623_b9e9_1f9b_643824244dcb
  db360cd6_f28e_70ed_0a28_57966d7b02ad["getDtsContent()"]
  db360cd6_f28e_70ed_0a28_57966d7b02ad -->|calls| 0cdd3045_dd6d_ed9f_790e_b712c12c2645
  style 0cdd3045_dd6d_ed9f_790e_b712c12c2645 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/db/src/core/integration/typegen.ts lines 15–26

function generateTableType(name: string, table: DBTable): string {
	const sanitizedColumnsList = Object.entries(table.columns)
		// Filter out deprecated columns from the typegen, so that they don't
		// appear as queryable fields in the generated types / your codebase.
		.filter(([, val]) => !val.schema.deprecated);
	const sanitizedColumns = Object.fromEntries(sanitizedColumnsList);
	let tableType = `	export const ${name}: import(${RUNTIME_IMPORT}).Table<
		${JSON.stringify(name)},
		${JSON.stringify(sanitizedColumns)}
	>;`;
	return tableType;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does generateTableType() do?
generateTableType() is a function in the astro codebase, defined in packages/db/src/core/integration/typegen.ts.
Where is generateTableType() defined?
generateTableType() is defined in packages/db/src/core/integration/typegen.ts at line 15.
What calls generateTableType()?
generateTableType() is called by 1 function(s): getDtsContent.

Analyze Your Own Codebase

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

Try Supermodel Free