describe method

RelationDescriptor describe(
  1. String name
)

Builds an instance-free RelationDescriptor for this relation under name.

Implementation

RelationDescriptor describe(String name) {
  final self = this;
  return switch (self) {
    BelongsTo() => RelationDescriptor(name: name, kind: RelationKind.belongsTo, targetType: targetType, foreignKey: self.foreignKey, localKey: self.localKey),
    HasMany() => RelationDescriptor(name: name, kind: RelationKind.hasMany, targetType: targetType, foreignKey: self.foreignKey, localKey: self.localKey),
    HasOne() => RelationDescriptor(name: name, kind: RelationKind.hasOne, targetType: targetType, foreignKey: self.foreignKey, localKey: self.localKey),
    ManyToMany() => RelationDescriptor(
        name: name,
        kind: RelationKind.manyToMany,
        targetType: targetType,
        foreignKey: self.thisForeignKey,
        localKey: self.thisLocalKey,
        pivotType: self.pivotType,
        otherForeignKey: self.otherForeignKey,
        otherLocalKey: self.otherLocalKey,
      ),
  };
}