Page Contents

Home > @loopback/repository > ModelDefinition

ModelDefinition class

Definition for a model

Signature:

export declare class ModelDefinition 

Constructors

Constructor Modifiers Description
(constructor)(nameOrDef)   Constructs a new instance of the ModelDefinition class

Properties

Property Modifiers Type Description
name   string  
properties   {
[name: string]: PropertyDefinition;
}
 
relations   RelationDefinitionMap  
settings   {
[name: string]: any;
}
 

Methods

Method Modifiers Description
addProperty(name, definitionOrType)   Add a property
addRelation(definition)   Define a new relation.
addSetting(name, value)   Add a setting
idProperties()   Get an array of names of ID properties, which are specified in the model settings or properties with id attribute.