Skip to content

RelationBuilder

Defined in: builder/relation.ts:15

Relations define relationships between templates in Alpyne. Relations are from a template to another. For example an employee has a parking space. This would be a “from employee” has one-to-one “to parking space”. In this case the “from” template is the employee and the “to” template is the parking space.

It is possible to navigate this relationship from either side. What is the from and to is largely a semantic and domain modelling decision.

readonly cardinality: RelationCardinality

Defined in: builder/relation.ts:19

The cardinality (e.g. one-to-many).


readonly evented: (key?) => EventBuilder

Defined in: builder/relation.ts:24

Flags that this relation will fire an event when set, updated, or removed.

string

EventBuilder


readonly fromKey: string

Defined in: builder/relation.ts:29

The key on the from template.


readonly prn: string

Defined in: builder/index.ts:32

BaseBuilder.prn


readonly toKey: string

Defined in: builder/relation.ts:37

The key on the to template. Often this is the same as the “from”, but it may be changed if there is a conflict or a different term makes sense when navigating to->from. For example a manager relation might be “manages” one way, but “hasManager” the other.

setDescription(description): this

Defined in: builder/index.ts:33

string

this

BaseBuilder.setDescription