UNPKG

@adonisjs/lucid

Version:

SQL ORM built on top of Active Record pattern

20 lines (19 loc) 1 kB
import { type LucidModel, type LucidRow } from '../../types/model.js'; import { type HasOneRelationContract } from '../../types/relations.js'; import { type RelationCallback, type FactoryModelContract, type FactoryRelationContract, type FactoryBuilderQueryContract } from '../../types/factory.js'; import { BaseRelation } from './base.js'; /** * Has one to factory relation */ export declare class HasOne extends BaseRelation implements FactoryRelationContract { relation: HasOneRelationContract<LucidModel, LucidModel>; constructor(relation: HasOneRelationContract<LucidModel, LucidModel>, factory: () => FactoryBuilderQueryContract<LucidModel, FactoryModelContract<LucidModel>>); /** * Make relationship and set it on the parent model instance */ make(parent: LucidRow, callback?: RelationCallback): Promise<void>; /** * Persist relationship and set it on the parent model instance */ create(parent: LucidRow, callback?: RelationCallback): Promise<void>; }