pub enum TypeExpr {
Predefined {
kind: PredefinedKind,
not_null: bool,
},
List {
element: Box<TypeExpr>,
not_null: bool,
},
PropertyValue {
not_null: bool,
},
Union(Vec<TypeExpr>),
Vector {
coord: Option<VectorCoordKind>,
dimension: Option<i64>,
not_null: bool,
},
}Expand description
A parsed <value type> per the CIP-86 grammar: the vocabulary used by
the CIP-87 type predicate expression (IS [NOT] :: <type>) and, once
CIP-90 ships, by valueType().
Variants§
Predefined
A predefined leaf type: a scalar, temporal, reference, point, map,
nothing/null, or the open ANY type. not_null reflects an
explicit NOT NULL suffix directly on this leaf’s own grammar
production (e.g. INTEGER NOT NULL).
List
LIST<T> / T LIST / ARRAY<T> / T ARRAY, with an optional
NOT NULL on the list value itself (not on its elements – element
nullability lives in element).
PropertyValue
[ANY] PROPERTY VALUE [NOT NULL]: the dynamic union of every
property-storable scalar type and lists thereof.
Union(Vec<TypeExpr>)
A closed dynamic union – ANY [VALUE] <A | B | ...> or the bare
A | B | ... form (equivalent). The grammar gives closed unions no
[NOT NULL] production of their own, so the parser never attaches
one here; a trailing NOT NULL after a union is a syntax error.
Vector
VECTOR<TYPE [NOT NULL]>(DIM) (Cypher style) or VECTOR(DIM, TYPE [NOT NULL]) (GQL style) (CIP-216). Either the coordinate type or
the dimension may be grammatically omitted (VECTOR(3),
VECTOR<INTEGER32>) – both parse fine but are rejected at
constraint-creation time, since a property type constraint requires
both. The coordinate type’s own NOT NULL is mandatory/implicit
(always rendered NOT NULL in canonical form) and so isn’t tracked
separately here; not_null is the outer NOT NULL on the whole
vector type (valid grammatically, but rejected for independent
property type constraints – CIP-216 doc, “for dependent property
type constraints only”).
Implementations§
Source§impl TypeExpr
impl TypeExpr
Sourcepub fn direct_not_null(&self) -> bool
pub fn direct_not_null(&self) -> bool
The NOT NULL flag attached directly to this node’s own grammar
production. Used only to check that a closed union’s components all
agree on nullability (CIP-86 “Not Null Uses”); closed unions have no
such production of their own, so they report false.