import knex from "knex"; import { IModel, InductModelOpts } from "./types/model-schema"; import { ValidationError } from "class-validator"; /** * Base class for CRUD operation APIs. Takes a generic type parameter based on */ export declare abstract class Model implements IModel { /** * Tenant database connection object. */ protected _con: knex; /** * Table name to do queries on */ protected _table_name: string; /** * Name of the ID field in the table as a string */ protected _id_field: keyof T; /** * Represents the transaction that the model is using */ protected _trx: knex.Transaction; /** * Stores the model data */ protected _model: T; protected _modelList: T[]; /** * Contains the model options used to generate the model instance */ protected _options: InductModelOpts; /** * Represents an object that can be used to create new database transactions */ protected trxProvider: any; /** * Represents whether the model data has been validated */ protected _validated: boolean; fields: Array | string; constructor(values: T, opts: InductModelOpts); get validated(): boolean; get options(): InductModelOpts; get con(): knex; get table_name(): string; get id_field(): keyof T; get model(): T; get trx(): knex.Transaction; destroyConnection(): Promise; startTransaction(): Promise; commitTransaction(): Promise; rollbackTransaction(): Promise; get(prop: K): T[K]; set(prop: K, value: T[K]): void; exists(column: K, value: T[K]): Promise; abstract findOneById(lookup?: T[keyof T]): Promise; abstract findAll(): Promise; abstract update(value?: Partial): Promise; abstract create(value?: Partial): Promise; abstract delete(lookup?: T[keyof T]): Promise; validate(): Promise; }