Class ModelRelationshipFacade
source · [−]Constructors
sourceconstructor
constructor
sourcenew <T>(_modelClass: ModelClass<T>): ModelRelationshipFacade<T>
new <T>(_modelClass: ModelClass<T>): ModelRelationshipFacade<T>
Properties
source_relationshipModel
_relationshipModel
source_relationship Model: IObjectionModelRelationship<T> = {}
_relationship Model: IObjectionModelRelationship<T> = {}
Accessors
Methods
sourceadd
add
source(modelClass: string | ModelClass<T>, relationshipTypeEnum: RelationshipEnum, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
(modelClass: string | ModelClass<T>, relationshipTypeEnum: RelationshipEnum, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
Create a relationship and add it inside of the class, saving the relationship mapping model inside. It will be able to get from the getter. Return the same class for chaining pattern.
memberof
ModelRelationshipFacade
sourcebelongsToOne
belongsToOne
source(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
Shortcut for RelationshipEnum.BelongsToOneRelation
memberof
ModelRelationshipFacade
sourcegeToField
geToField
source(modelClass: string | ModelClass<T>, relation: RelationshipEnum): string
(modelClass: string | ModelClass<T>, relation: RelationshipEnum): string
Return the field name of "to" prop of "join" section
memberof
ModelRelationshipFacade
sourcegetFromField
getFromField
source(modelClass: string | ModelClass<T>, relation: RelationshipEnum): string
(modelClass: string | ModelClass<T>, relation: RelationshipEnum): string
Return the field name of "from" prop of "join" section
memberof
ModelRelationshipFacade
sourcegetRelationshipName
getRelationshipName
source(modelClass: string | ModelClass<T>, relation: RelationshipEnum): string
(modelClass: string | ModelClass<T>, relation: RelationshipEnum): string
Return the name of the relationship between the origin model to the end model. This is created based on the relationship between them.
memberof
ModelRelationshipFacade
sourcegetRelationshipType
getRelationshipType
source(relationshipEnum: RelationshipEnum): RelationType
(relationshipEnum: RelationshipEnum): RelationType
Return model RelationType based on the enum
memberof
ModelRelationshipFacade
sourcegetRelationships
getRelationships
source(opt?: IRelationshipDebugOptions<T>): IObjectionModelRelationship<T>
(opt?: IRelationshipDebugOptions<T>): IObjectionModelRelationship<T>
Return the relationship model created from adding relationship on "Add" method
memberof
ModelRelationshipFacade
sourcehasMany
hasMany
source(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
Shortcut for RelationshipEnum.HasManyRelation
memberof
ModelRelationshipFacade
sourcehasOne
hasOne
source(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
Shortcut for RelationshipEnum.HasOneRelation
memberof
ModelRelationshipFacade
sourcehasOneThrough
hasOneThrough
source(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
Shortcut for RelationshipEnum.HasOneThroughRelation
memberof
ModelRelationshipFacade
sourcemanyToMany
manyToMany
source(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
(modelClass: string | ModelClass<T>, config?: IObjectionModelRelationshipAddConfig): ModelRelationshipFacade<T>
Shortcut for RelationshipEnum.ManyToManyRelation
memberof
ModelRelationshipFacade