belongsTo<Parent extends RelationalModel<Parent>, Child extends RelationalModel<Child>> function

Relation<Parent, Child> belongsTo<Parent extends RelationalModel<Parent>, Child extends RelationalModel<Child>>(
  1. RelationalModel<Child> child,
  2. String foreignKey, [
  3. String? ownerKey,
  4. RelationScope? scope,
])

Implementation

Relation<Parent, Child> belongsTo<Parent extends RelationalModel<Parent>,Child extends RelationalModel<Child>>(
  RelationalModel<Child> child,
  String foreignKey,
  [
    String? ownerKey,
    RelationScope? scope,
  ]
) {
  return Relation(
    child: child,
    type: RelationType.belongsTo,
    foreignKey: foreignKey,
    localKey: ownerKey, // null -> remote PK
    scope: scope,
  );
}