Skip to main content
Version: Next

abstractFactory <TEntity, TInput>

Index

Constructors

constructor

Properties

abstractreadonlymodel

model: Constructor<TEntity>

Methods

create

  • create(amount: number, input?: TInput): Promise<TEntity[]>
  • Create (and flush) multiple entities


    Parameters

    • amount: number

      Number of entities that should be generated

    • optionalinput: TInput

      Object specifying what default attributes of the entity factory should be overridden

    Returns Promise<TEntity[]>

createOne

  • createOne(input?: TInput): Promise<TEntity>
  • Create (and flush) a single entity


    Parameters

    • optionalinput: TInput

      Object specifying what default attributes of the entity factory should be overridden

    Returns Promise<TEntity>

each

  • each(eachFunction: (entity: TEntity, index: number) => void): Factory<TEntity, TInput>
  • Set a function that is applied to each entity before it is returned In case of createOne or create it is applied before the entity is persisted


    Parameters

    • eachFunction: (entity: TEntity, index: number) => void

      The function that is applied on every entity

      Returns Factory<TEntity, TInput>

    make

    • make(amount: number, input?: TInput): TEntity[]
    • Make multiple entities and then persist them (not flush)


      Parameters

      • amount: number

        Number of entities that should be generated

      • optionalinput: TInput

        Object specifying what default attributes of the entity factory should be overridden

      Returns TEntity[]

    makeEntity

    • makeEntity(input?: TInput, index?: number): TEntity
    • Make a single entity instance, without persisting it.


      Parameters

      • optionalinput: TInput

        Object specifying what default attributes of the entity factory should be overridden

      • index: number = 0

      Returns TEntity

    makeOne

    • makeOne(input?: TInput): TEntity
    • Make a single entity and persist (not flush)


      Parameters

      • optionalinput: TInput

        Object specifying what default attributes of the entity factory should be overridden

      Returns TEntity