adba
Version:
Any DataBase to API
24 lines (23 loc) • 1.11 kB
TypeScript
import { Model } from "objection";
import { Knex } from "knex";
import { IGenerateModelsOptions } from "./types";
/**
* Generates MySQL 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 generateMySQLModels(knexInstance: Knex, opts?: IGenerateModelsOptions): Promise<Record<string, typeof Model>>;
/**
* Maps MySQL data types to corresponding JSON Schema types.
* @param mysqlType - The MySQL data type.
* @returns The JSON Schema type.
*/
export declare function mapMySqlTypeToJsonType(mysqlType: string): string;
/**
* Maps MySQL data types to corresponding JSON Schema formats.
* @param mysqlType - The MySQL data type.
* @param colName - The column name for potential additional format inference.
* @returns The JSON Schema format if applicable.
*/
export declare function mapMySqlTypeToJsonFormat(mysqlType: string, colName: string): string | undefined;