Entity
    Preparing search index...

    Class PostgresEntity<TFields, TIDField, TViewerContext, TSelectedFields>Abstract

    Abstract base class for mutable entities backed by Postgres. Provides knexLoader and knexLoaderWithAuthorizationResults as inherited static methods, in addition to the mutation methods inherited from Entity.

    Type Parameters

    • TFields extends Record<string, any>
    • TIDField extends keyof NonNullable<Pick<TFields, TSelectedFields>>
    • TViewerContext extends ViewerContext
    • TSelectedFields extends keyof TFields = keyof TFields

    Hierarchy

    Index

    Methods

    • Returns Readonly<TFields>

      all underlying fields from this entity's database data

    • Returns Readonly<Pick<TFields, TSelectedFields>>

      all underlying fields from this entity's data

    • Get a underlying field from this entity's data

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • fieldName: K

        the field to get

      Returns Pick<TFields, TSelectedFields>[K]

      the value of the field or undefined if not loaded with that field

    • Returns TFields[TIDField]

      the ID of this entity

    • Returns string

    • Returns TViewerContext

      the ViewerContext authorized to read this entity

    • Returns string