1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Metadata describing a relation between two models.
//!
//! Every relation emitted by codegen materializes as a zero-sized type
//! implementing [`RelationMeta`]. The meta trait carries enough type-level
//! and const-level information for the runtime relation executor
//! ([`super::executor`]) to build the secondary SELECT statement for
//! an `.include()` call without reflection.
//!
//! # Kinds
//!
//! - [`RelationKind::BelongsTo`] — the owner holds a FK to the target's PK.
//! `LOCAL_KEY` is the owner's column pointing at the target.
//! - [`RelationKind::HasMany`] — the target holds a FK to the owner's PK.
//! `FOREIGN_KEY` is the target's column pointing back at the owner.
//! - [`RelationKind::HasOne`] — like `HasMany` but with a uniqueness
//! constraint on the target's FK column.
//!
//! The trait itself is deliberately inert — it is consulted by the
//! executor and never implements any actual loading logic. That keeps
//! the per-model impl emitted by the derive macro trivial.
use crateModel;
/// Classification of a relation between two models.
/// Each relation emitted by codegen materializes as a zero-sized type
/// implementing this trait. `Owner` is the model declaring the relation;
/// `Target` is the related model. `LOCAL_KEY` is the column on `Owner`
/// that references `Target` (for `BelongsTo`); `FOREIGN_KEY` is the
/// column on `Target` that references `Owner`'s PK (for `HasMany` /
/// `HasOne`).