Skip to main content
Version: 5.9

ChangeSetPersister

Index

Constructors

constructor

  • new ChangeSetPersister(driver: IDatabaseDriver<Connection>, metadata: MetadataStorage, hydrator: IHydrator, factory: EntityFactory, validator: EntityValidator, config: Configuration<IDatabaseDriver<Connection>>): ChangeSetPersister
  • Parameters

    • driver: IDatabaseDriver<Connection>
    • metadata: MetadataStorage
    • hydrator: IHydrator
    • factory: EntityFactory
    • validator: EntityValidator
    • config: Configuration<IDatabaseDriver<Connection>>

    Returns ChangeSetPersister

Methods

executeDeletes

  • executeDeletes<T>(changeSets: ChangeSet<T>[], options?: DriverMethodOptions, withSchema?: boolean): Promise<void>
  • Type parameters

    • T: object

    Parameters

    • changeSets: ChangeSet<T>[]
    • optionaloptions: DriverMethodOptions
    • optionalwithSchema: boolean

    Returns Promise<void>

executeInserts

  • executeInserts<T>(changeSets: ChangeSet<T>[], options?: DriverMethodOptions, withSchema?: boolean): Promise<void>
  • Type parameters

    • T: object

    Parameters

    • changeSets: ChangeSet<T>[]
    • optionaloptions: DriverMethodOptions
    • optionalwithSchema: boolean

    Returns Promise<void>

executeUpdates

  • executeUpdates<T>(changeSets: ChangeSet<T>[], batched: boolean, options?: DriverMethodOptions, withSchema?: boolean): Promise<void>
  • Type parameters

    • T: object

    Parameters

    • changeSets: ChangeSet<T>[]
    • batched: boolean
    • optionaloptions: DriverMethodOptions
    • optionalwithSchema: boolean

    Returns Promise<void>

mapReturnedValues

  • mapReturnedValues<T>(entity: T, payload: EntityDictionary<T>, row: undefined | Dictionary, meta: EntityMetadata<T>, override?: boolean): void
  • Maps values returned via returning statement (postgres) or the inserted id (other sql drivers). No need to handle composite keys here as they need to be set upfront. We do need to map to the change set payload too, as it will be used in the originalEntityData for new entities.


    Type parameters

    • T: object

    Parameters

    • entity: T
    • payload: EntityDictionary<T>
    • row: undefined | Dictionary
    • meta: EntityMetadata<T>
    • override: boolean = false

    Returns void