MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / from

Method from

sea-orm-codegen/src/entity/relation.rs:220–241  ·  view source on GitHub ↗
(tbl_fk: &TableForeignKey)

Source from the content-addressed store, hash-verified

218
219impl From<&TableForeignKey> for Relation {
220 fn from(tbl_fk: &TableForeignKey) -> Self {
221 let ref_table = match tbl_fk.get_ref_table() {
222 Some(s) => unpack_table_ref(s),
223 None => panic!("RefTable should not be empty"),
224 };
225 let columns = tbl_fk.get_columns();
226 let ref_columns = tbl_fk.get_ref_columns();
227 let rel_type = RelationType::BelongsTo;
228 let on_delete = tbl_fk.get_on_delete();
229 let on_update = tbl_fk.get_on_update();
230 Self {
231 ref_table,
232 columns,
233 ref_columns,
234 rel_type,
235 on_delete,
236 on_update,
237 self_referencing: false,
238 num_suffix: 0,
239 impl_related: true,
240 }
241 }
242}
243
244#[cfg(test)]

Callers

nothing calls this directly

Calls 1

unpack_table_refFunction · 0.50

Tested by

no test coverage detected