pub struct Cycle {
pub(crate) expr: Option<Expr>,
pub(crate) set_as: Option<DynIden>,
pub(crate) using: Option<DynIden>,
}
Expand description
For recursive WithQuery WithClauses the CYCLE sql clause can be specified to avoid creating an infinite traversals that loops on graph cycles indefinitely.
You specify an expression that identifies a node in the graph, which is used during the query execution iteration, to determine newly appended values are distinct new nodes or are already visited, and therefore they should be added into the result again.
A query can have both SEARCH and CYCLE clauses.
Setting Self::set, Self::expr and Self::using is mandatory.
Fields§
§expr: Option<Expr>
§set_as: Option<DynIden>
§using: Option<DynIden>
Implementations§
Source§impl Cycle
impl Cycle
Sourcepub fn new_from_expr_set_using<EXPR, ID1, ID2>(
expr: EXPR,
set: ID1,
using: ID2,
) -> Self
pub fn new_from_expr_set_using<EXPR, ID1, ID2>( expr: EXPR, set: ID1, using: ID2, ) -> Self
Create a complete Search specification from the SearchOrder and a SelectExpr. The given SelectExpr must have an alias specified.
Sourcepub fn set<ID>(&mut self, set: ID) -> &mut Selfwhere
ID: IntoIden,
pub fn set<ID>(&mut self, set: ID) -> &mut Selfwhere
ID: IntoIden,
The name of the boolean column containing whether we have completed a cycle or not yet generated by this clause.
Sourcepub fn using<ID>(&mut self, using: ID) -> &mut Selfwhere
ID: IntoIden,
pub fn using<ID>(&mut self, using: ID) -> &mut Selfwhere
ID: IntoIden,
The name of the array typed column that contains the node ids (generated using the Self::expr) that specify the current nodes path that will be generated by this clause.