adba
Version:
Any DataBase to API
24 lines (23 loc) • 1.17 kB
TypeScript
import { Model, JSONSchemaTypeName } from 'objection';
import { Knex } from 'knex';
import { IGenerateModelsOptions } from './types';
/**
* Generates SQLite models using Knex and the provided options for parsing and formatting.
* @param knexInstance - The Knex instance connected to the SQLite database.
* @param opts - The options containing parse and format functions.
* @returns A promise that resolves to a record of models.
*/
export declare function generateSQLiteModels(knexInstance: Knex, opts?: IGenerateModelsOptions): Promise<Record<string, typeof Model>>;
/**
* Maps SQLite data types to corresponding JSON Schema types.
* @param sqliteType - The SQLite data type.
* @returns The JSON Schema type.
*/
export declare function mapSqliteTypeToJsonType(sqliteType: string): JSONSchemaTypeName;
/**
* Maps SQLite data types to corresponding JSON Schema formats.
* @param sqliteType - The SQLite data type.
* @param colName - The column name for potential additional format inference.
* @returns The JSON Schema format if applicable.
*/
export declare function mapSqliteTypeToJsonFormat(sqliteType: string, colName: string): string | undefined;