Skip to main content

ModelGraph

@webda/compiler


Type Alias: ModelGraph

ModelGraph = object

Defined in: definition.ts:67

Defined relationship for one model

Properties​

ancestors?​

optional ancestors?: string[]

Defined in: definition.ts:71

Model names of the parent of the parent, etc...


behaviors?​

optional behaviors?: ModelGraphBehaviorDefinition[]

Defined in: definition.ts:146

Behavior attributes — properties whose type is a class marked with @Behavior(). The Behavior class is referenced by Identifier so that the Behavior's actions can be looked up in the top-level behaviors map of the module.


binaries?​

optional binaries?: ModelGraphBinaryDefinition[]

Defined in: definition.ts:139

Binaries attribute, in the model you can declare attributes as Binary, so users can upload binaries that will be linked to this object with some metadata


children?​

optional children?: string[]

Defined in: definition.ts:133

References to every model that declare this model as a parent


optional links?: ModelRelation[]

Defined in: definition.ts:82

This contains links to other models. These links are low cardinality as ids and their selected attributes are stored in the current model.


maps?​

optional maps?: object[]

Defined in: definition.ts:110

Maps are deduplication of data in your model They are managed automatically by a service like ModelMapper

They are useful in NoSQL environment like DynamoDB or Firebase

attribute​

attribute: string

Attribute in the model

cascadeDelete​

cascadeDelete: boolean

model​

model: string

Target model

targetAttributes​

targetAttributes: string[]

Target model attributes to duplicate

targetLink: string


parent?​

optional parent?: Omit<ModelRelation, "type">

Defined in: definition.ts:75

If the model has a parent


queries?​

optional queries?: object[]

Defined in: definition.ts:90

Target other models with a new query This is usually our foreign keys

This will generate queries for you: SELECT * FROM 'model' WHERE 'targetAttribute' = 'this[attribute]'

attribute​

attribute: string

Attribute in the model

model​

model: string

Targeted model

targetAttribute​

targetAttribute: string

Targeted model attribute