adba
Version:
Any DataBase to API
24 lines (23 loc) • 1.16 kB
TypeScript
import { Model } from 'objection';
import { Knex } from 'knex';
import { IGenerateModelsOptions } from './types';
/**
* Generates PostgreSQL models dynamically based on database structures.
* @param knexInstance - The Knex instance connected to the database.
* @param opts - Options including parse and format functions.
* @returns A promise that resolves to an object containing all generated models.
*/
export declare function generatePostgreSQLModels(knexInstance: Knex, opts?: IGenerateModelsOptions): Promise<Record<string, typeof Model>>;
/**
* Maps PostgreSQL data types to corresponding JSON Schema types.
* @param postgresType - The PostgreSQL data type.
* @returns The JSON Schema type.
*/
export declare function mapPostgresTypeToJsonType(postgresType: string): string;
/**
* Maps PostgreSQL data types to corresponding JSON Schema formats.
* @param postgresType - The PostgreSQL data type.
* @param colName - The column name for potential additional format inference.
* @returns The JSON Schema format if applicable.
*/
export declare function mapPostgresTypeToJsonFormat(postgresType: string, colName: string): string | undefined;