pub struct Path { /* private fields */ }Expand description
A graph-traversal expression — e.g. ->wrote->post, <-wrote<-user, or a
multi-hop chain with an optional .field/.* accessor at the end.
A Path is a DynExpr, so it works anywhere the builder takes an
expression: as a SELECT projection (Projection::aliased(path, "posts")),
inside a WHERE filter, or as a SET value. With no start it is relative to
the statement’s FROM table; Path::from_record anchors it to a record.
// ->wrote->post.title AS titles
let p = Path::out::<Wrote>().to::<Post>().field("title");
Post::table().project(vec![Projection::aliased(p, "titles")]);Implementations§
Source§impl Path
impl Path
Sourcepub fn out<E>() -> Pathwhere
E: SurrealEdge,
pub fn out<E>() -> Pathwhere
E: SurrealEdge,
Start an outgoing hop over edge E — ->edge.
Sourcepub fn inn<E>() -> Pathwhere
E: SurrealEdge,
pub fn inn<E>() -> Pathwhere
E: SurrealEdge,
Start an incoming hop over edge E — <-edge.
Sourcepub fn both<E>() -> Pathwhere
E: SurrealEdge,
pub fn both<E>() -> Pathwhere
E: SurrealEdge,
Start a bidirectional hop over edge E — <->edge.
Sourcepub fn out_edge(edge: &'static str) -> Path
pub fn out_edge(edge: &'static str) -> Path
Start an outgoing hop over a raw edge name — ->edge.
Sourcepub fn in_edge(edge: &'static str) -> Path
pub fn in_edge(edge: &'static str) -> Path
Start an incoming hop over a raw edge name — <-edge.
Sourcepub fn both_edge(edge: &'static str) -> Path
pub fn both_edge(edge: &'static str) -> Path
Start a bidirectional hop over a raw edge name — <->edge.
Sourcepub fn from_record<V>(self, start: V) -> Pathwhere
V: SurrealQL,
pub fn from_record<V>(self, start: V) -> Pathwhere
V: SurrealQL,
Anchor an existing path to a starting record literal — <record><path>
(e.g. user:tobie->wrote->post). Pass a Thing.
Sourcepub fn from_expr(self, start: impl DynExpr + 'static) -> Path
pub fn from_expr(self, start: impl DynExpr + 'static) -> Path
Anchor an existing path to a starting expression — e.g. a
RecordLink (type::record('user', $id)->wrote->post).
Sourcepub fn to<T>(self) -> Pathwhere
T: SurrealRecord,
pub fn to<T>(self) -> Pathwhere
T: SurrealRecord,
Constrain the destination of the most recent hop to table T — ->edge->table.
Sourcepub fn to_table(self, table: &'static str) -> Path
pub fn to_table(self, table: &'static str) -> Path
Constrain the destination of the most recent hop to a raw table name.
Sourcepub fn where_(self, expr: impl DynExpr + 'static) -> Path
pub fn where_(self, expr: impl DynExpr + 'static) -> Path
Filter the most recent hop’s edge — ->(edge WHERE <expr>).
Sourcepub fn then_out<E>(self) -> Pathwhere
E: SurrealEdge,
pub fn then_out<E>(self) -> Pathwhere
E: SurrealEdge,
Chain another outgoing hop over edge E.
Sourcepub fn then_in<E>(self) -> Pathwhere
E: SurrealEdge,
pub fn then_in<E>(self) -> Pathwhere
E: SurrealEdge,
Chain another incoming hop over edge E.
Sourcepub fn then_both<E>(self) -> Pathwhere
E: SurrealEdge,
pub fn then_both<E>(self) -> Pathwhere
E: SurrealEdge,
Chain another bidirectional hop over edge E.
Sourcepub fn then_out_edge(self, edge: &'static str) -> Path
pub fn then_out_edge(self, edge: &'static str) -> Path
Chain another hop over a raw edge name, outgoing.
Sourcepub fn then_in_edge(self, edge: &'static str) -> Path
pub fn then_in_edge(self, edge: &'static str) -> Path
Chain another hop over a raw edge name, incoming.
Sourcepub fn recurse_all(self) -> Path
pub fn recurse_all(self) -> Path
Repeat the path recursively, unbounded — @.{..}<path>. Combine with
from_record to anchor the recursion at a record
(person:tobie.{..}->knows->person).
Sourcepub fn recurse_up_to(self, max: u32) -> Path
pub fn recurse_up_to(self, max: u32) -> Path
Recurse up to max hops — @.{..max}<path>.
Sourcepub fn recurse_range(self, min: u32, max: u32) -> Path
pub fn recurse_range(self, min: u32, max: u32) -> Path
Recurse between min and max hops — @.{min..max}<path>.
Sourcepub fn recurse_exact(self, n: u32) -> Path
pub fn recurse_exact(self, n: u32) -> Path
Recurse exactly n hops — @.{n}<path>.
Sourcepub fn contains<V>(self, value: V) -> ContainsExprwhere
V: SurrealQL,
pub fn contains<V>(self, value: V) -> ContainsExprwhere
V: SurrealQL,
<path> CONTAINS <value> — e.g. membership test over a traversed list.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Path
impl !UnwindSafe for Path
impl Freeze for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnsafeUnpin for Path
Blanket Implementations§
impl<T> AsyncFriendly for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request