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
//! What a relation subquery may see of its *related* table.
//!
//! A relation filter (`EXISTS (SELECT 1 FROM related WHERE ...)`) or a
//! relation sort (`(SELECT related.col FROM related WHERE ... LIMIT 1)`)
//! reads the related table directly. Unless that subquery applies the
//! related model's own read policy and soft-delete filter, a caller can
//! test and order by values of rows they cannot read — rows `?include=`
//! correctly reports as `null` / absent (GHSA-p55v-6xv5-93p3).
//!
//! Every public constructor of a relation hop, relation filter or
//! relation sort therefore takes a [`RelatedReadScope`]; there is no
//! default. Generated code passes the related model's
//! [`ModelDescriptor::related_read_scope`]. Hand-written code that
//! genuinely wants the raw table passes [`RelatedReadScope::Unscoped`],
//! which is the named escape hatch and never the fallback.
use ReadPolicy;
use crateModelDescriptor;