Skip to main content
Version: Next

DataloaderUtils

Index

Constructors

constructor

Methods

staticentitiesAndOptsMapToQueries

  • Turn the entity+options map into actual queries. The keys are the entity names + a strigified version of the options and the values are filter Maps which will be used as the values of an $or operator so we end up with a query per entity+opts. We must populate the inverse side of the relationship in order to be able to later retrieve the PK(s) from its item(s). Together with the query the promises will also return the key which can be used to narrow down the results pertaining to a certain set of options.


    Parameters

    Returns Promise<[string, any[]]>[]

staticgetColBatchLoadFn

staticgetColFilter

  • getColFilter<T, S>(collection: Collection<any, object>): (result: T) => result is S
  • Creates a filter which returns the results pertaining to a certain collection. First checks if the Entity type matches, then retrieves the inverse side of the relationship where the filtering will be done in order to match the target collection.


    Type parameters

    • T
    • S

    Parameters

    Returns (result: T) => result is S

      • (result: T): result is S
      • Parameters

        • result: T

        Returns result is S

staticgetDataloaderType

staticgetRefBatchLoadFn

staticgroupInversedOrMappedKeysByEntityAndOpts

  • groupInversedOrMappedKeysByEntityAndOpts(collsWithOpts: readonly [Collection<any, object>, Omit<InitCollectionOptions<any, any, *, never>, dataloader>?][]): Map<string, Map<string, Set<any>>>
  • Groups collections by entity and returns a Map whose keys are the entity names and whose values are filter Maps which we can use to narrow down the find query to return just the items of the collections that have been dataloaded. The entries of the filter Map will be used as the values of an $or operator so we end up with a query per entity.


    Parameters

    Returns Map<string, Map<string, Set<any>>>

staticgroupPrimaryKeysByEntityAndOpts

  • groupPrimaryKeysByEntityAndOpts(refsWithOpts: readonly [Reference<any>, Omit<LoadReferenceOptions<any, any, *, never>, dataloader>?][]): Map<string, Set<any>>
  • Groups identified references by entity and returns a Map with the class name as the index and the corresponging primary keys as the value.


    Parameters

    Returns Map<string, Set<any>>