UNPKG

@adonisjs/lucid

Version:

SQL ORM built on top of Active Record pattern

42 lines (41 loc) 1.21 kB
import type { SchemaRules, DatabaseColumn, GeneratedSchemas } from '../../types/schema_generator.ts'; import { type QueryClientContract } from '../../types/database.ts'; /** * OrmSchemaBuilder handles the core logic of generating TypeScript * model schemas from database table structures. */ export declare class OrmSchemaBuilder { private client; /** * Schema rules for type mapping and customization */ private schema; /** * Mapping from database types to internal type identifiers */ private dataTypes; constructor(client: QueryClientContract); /** * Load user-defined schema rules */ loadRules(rules: SchemaRules[]): void; /** * Generate schema for a single column */ private generateColumnSchema; /** * Generate schema for a single table (internal method) */ private generateTableSchema; /** * Generate schemas for multiple tables */ generateSchemas(tables: Array<{ name: string; columns: Record<string, DatabaseColumn>; }>): GeneratedSchemas; /** * Get the final output string from generated schemas */ getOutput(schemas: GeneratedSchemas): string; }