/** * @athenna/database * * (c) João Lenon * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { Macroable } from '@athenna/common'; import type { RelationOptions } from '#src/types'; import type { BaseModel } from '#src/models/BaseModel'; import { ModelSchema } from '#src/models/schemas/ModelSchema'; export declare class ModelGenerator extends Macroable { /** * The model that will be generated instances * from. */ private Model; /** * The model schema that will be used to search * for columns and relations. */ private schema; constructor(model: new () => M, schema: ModelSchema); /** * Generate one model instance with relations loaded. */ generateOne(data: any): Promise; /** * Generate models instances with relations loaded. */ generateMany(data: any[]): Promise; /** * Instantiate one model using vanilla database data. */ private instantiateOne; /** * Populate one object data in the model instance * using the column dictionary to map keys. */ private populate; /** * Include one relation to one model. */ includeRelation(model: M, relation: RelationOptions): Promise; /** * Include all relations to one model. */ private includeRelations; /** * Include one relation for all models. */ private includeRelationOfAll; /** * Include all relations for all models. */ private includeRelationsOfAll; }