/** * @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 { BaseModel } from '#src/models/BaseModel'; export declare class ModelFactory extends Macroable { /** * The model that will be used to fabricate * instances from. */ private Model; /** * The number of models to be created. */ private _count; /** * Set if the soft delete state is active or not. */ private _trashed; /** * Set the returning key that this factory will return. */ private _returning; constructor(model: typeof BaseModel); returning(key: '*'): ModelFactory; returning(key: T): ModelFactory; /** * Same as returning method, but return the type of * the key of the model to avoid using "as any" or * other kind of stuffs to fix the type in definition * method. * * Only the type is modified for convenience, the real * return type of this method is still the ModelFactory * instance. */ returningAs(key: T): M[T]; /** * Set the soft delete state in your model to * fabricate deleted data. */ trashed(): this; /** * Remove the soft delete state in your model to * not fabricate deleted data. */ untrashed(): this; count(number: 1): ModelFactory; count(number: number): ModelFactory; /** * Make models without creating it on database. */ make(override?: Partial): Promise; /** * Create models creating it on database. */ create(override?: Partial): Promise; /** * Execute the definition method and return data. */ private getDefinition; }