#[non_exhaustive]pub struct ParseContext<'a> {
pub source: &'a str,
pub session_id: &'a str,
pub query_type: QueryType,
pub params: &'a [(SmolStr, ScalarValue)],
}Expand description
Parse-phase context.
query_type defaults to QueryType::Cypher for back-compat with
hooks built against the v1.0 shape; populate via
Self::with_query_type when the host knows the language up front.
params defaults to an empty slice; populate via
Self::with_params to surface bound query parameters to hooks
(Arrow-shaped to keep uni-plugin free of any uni-common dep).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source: &'a strRaw source text of the query.
session_id: &'a strSession identifier.
query_type: QueryTypeQuery language classification (v1.1).
params: &'a [(SmolStr, ScalarValue)]Bound query parameters as (name, value) pairs (v1.1).
Implementations§
Source§impl<'a> ParseContext<'a>
impl<'a> ParseContext<'a>
Sourcepub fn new(source: &'a str, session_id: &'a str) -> Self
pub fn new(source: &'a str, session_id: &'a str) -> Self
Construct a parse context with defaults for the v1.1 fields.
Hooks built outside of uni-plugin use this constructor; the
struct is #[non_exhaustive] so direct struct-literal
construction is forbidden. query_type defaults to
QueryType::Cypher; params defaults to an empty slice.
Override via the builders below.
Sourcepub fn with_query_type(self, query_type: QueryType) -> Self
pub fn with_query_type(self, query_type: QueryType) -> Self
Override the query-language classification.
Sourcepub fn with_params(self, params: &'a [(SmolStr, ScalarValue)]) -> Self
pub fn with_params(self, params: &'a [(SmolStr, ScalarValue)]) -> Self
Attach a borrowed slice of bound query parameters.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ParseContext<'a>
impl<'a> !UnwindSafe for ParseContext<'a>
impl<'a> Freeze for ParseContext<'a>
impl<'a> Send for ParseContext<'a>
impl<'a> Sync for ParseContext<'a>
impl<'a> Unpin for ParseContext<'a>
impl<'a> UnsafeUnpin for ParseContext<'a>
Blanket Implementations§
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 more