Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RelationshipMetadata

Represents a relationship between two tables.

Hierarchy

  • RelationshipMetadata

Index

Constructors

Properties

Constructors

constructor

  • Initialize the relationship metadata.

    Parameters

    • Entity: TableType

      The type (constructor) of the table where this relationship was defined.

    • mapTo: string

      The property in Entity on which this relationship was defined.

    • to: function

      A function that, when called, returns the referenced Entity type (constructor).

    • on: function

      A function that, when called, returns an array consisting of the names of the local and remote properties. E.g. (user, phoneNumber) => [user.id, phoneNumber.userID] (returns ['userID', 'phoneNumberID']). The function will be passed PropertyMapTypes containing all the decorated properties of Entity and RefEntity. If the relationship between Entity and RefEntity depends on multiple columns, then an array of arrays should be returned.

    • cardinality: CardinalityType

      The relationship type (e.g. OneToMany).

    Returns RelationshipMetadata

Properties

Entity

Entity: TableType

The type (constructor) of the table where this relationship was defined.

cardinality

cardinality: CardinalityType

The relationship type (e.g. OneToMany).

mapTo

mapTo: string

The property in Entity on which this relationship was defined.

on

on: function

A function that, when called, returns an array consisting of the names of the local and remote properties. E.g. (user, phoneNumber) => [user.id, phoneNumber.userID] (returns ['userID', 'phoneNumberID']). The function will be passed PropertyMapTypes containing all the decorated properties of Entity and RefEntity. If the relationship between Entity and RefEntity depends on multiple columns, then an array of arrays should be returned.

Type declaration

to

to: function

A function that, when called, returns the referenced Entity type (constructor).

Type declaration

Generated using TypeDoc