import { Column, Config, Database, Schema, Table } from './Typings.js'; import { Knex } from 'knex'; interface ClientWithConfig { /** * Fetches the database schema from the database * @param db Optional Knex instance to use for fetching the database schema */ fetchDatabase(db?: Knex): ClientWithDatabase; } interface ClientWithDatabase { /** * Maps a single table to a new table definition * @param identifer . identifier of the table to map * @param func Function to call for this table. The function should return a new table object */ mapTable(identifer: string, func: (table: Table, schema: Schema) => Table): ClientWithDatabase; /** * Maps all tables to a new table definition * @param func Function to call for each table. The function should return a new table object */ mapTables(func: (table: Table, schema: Schema) => Table): ClientWithDatabase; /** * Maps a single column to a new column definition * @param identifier .
. identifier of the column to map * @param func Function to call for this column. The function should return a new column object */ mapColumn(identifier: string, func: (column: Column, table: Table, schema: Schema) => Column): ClientWithDatabase; /** * Maps all columns to a new column definition * @param func Function to call for each column. The function should return a new column object */ mapColumns(func: (column: Column, table: Table, schema: Schema) => Column): ClientWithDatabase; /** * Maps a single schema to a new schema definition * @param identifier identifier of the schema to map * @param func Function to call for this schema. The function should return a new schema object */ mapSchema(identifer: string, func: (schema: Schema) => Schema): ClientWithDatabase; /** * Maps all schemas to a new schema definition * @param func Function to call for each schema. The function should return a new schema object */ mapSchemas(func: (schema: Schema) => Schema): ClientWithDatabase; /** * Asynchronously generates a typescript definition file */ toTypescript(): Promise; /** * Asynchronously generates a database definition object */ toObject(): Promise; } export declare class Client implements ClientWithConfig, ClientWithDatabase { private config; private databaseProvider; private databaseMappings; private constructor(); /** * Creates a new Client with the given sql-ts configuration * @param config The configuration object for the database * @returns A Client with the given configuration */ static fromConfig(config: Config): ClientWithConfig; /** * Creates a new Client with the given database definition from {@link ClientWithDatabase.toObject} * @param schema The database definition to use * @param config The sql-ts configuration object * @returns A Client with the given database schema */ static fromObject(schema: Database, config: Config): ClientWithDatabase; fetchDatabase(db?: Knex): ClientWithDatabase; mapTable(identifer: string, func: (table: Table, schema: Schema) => Table): ClientWithDatabase; mapTables(func: (table: Table, schema: Schema) => Table): ClientWithDatabase; mapColumn(identifier: string, func: (column: Column, table: Table, schema: Schema) => Column): ClientWithDatabase; mapColumns(func: (column: Column, table: Table, schema: Schema) => Column): ClientWithDatabase; mapSchema(identifier: string, func: (schema: Schema) => Schema): ClientWithDatabase; mapSchemas(func: (schema: Schema) => Schema): ClientWithDatabase; toTypescript(): Promise; toObject(): Promise; } export {};