Class UniqueFieldManager<T, ModelType>

class: UniqueFieldManager

  • support .{field} is unique in typed-storage-service.
  • make lookup data entry to save the reverse mapping to origin id.
  • set .stereo as '#' to mark as lookup. (to filter out from Elastic.search())
  • set .id as #{field}/{name} or #{name}.
  • set .meta as origin id.

Type Parameters

  • T extends CoreModel<ModelType>

  • ModelType extends string

Hierarchy

  • UniqueFieldManager

Constructors

Properties

field: string
storage: TypedStorageService<T, ModelType>
type: ModelType

Methods

  • lookup model by value

    • use .meta property to link with the origin.
    • mark .stereo as to '#' to distinguish normal.

    Parameters

    • value: string

      unique value in same type group.

    • Optional $creates: T

      (optional) create-set if not found.

    Returns Promise<T>

  • update lookup table (or create)

    Parameters

    • model: T

      target model

    • Optional value: string

      (optional) new value of model.

    Returns Promise<T>

Generated using TypeDoc