pub struct Statement { /* private fields */ }Expand description
PostgreSQL statement, parsed by pg_query.
Implements Deref on PdStatement, which is passed
in using the FFI interface.
Use the PdStatement::protobuf method to obtain a reference
to the Abstract Syntax Tree.
§Example
use pgdog_plugin::pg_query::NodeEnum;
let ast = statement.protobuf();
let root = ast
.stmts
.first()
.unwrap()
.stmt
.as_ref()
.unwrap()
.node
.as_ref();
if let Some(NodeEnum::SelectStmt(stmt)) = root {
println!("SELECT statement: {:#?}", stmt);
}
Methods from Deref<Target = PdStatement>§
Sourcepub fn protobuf(&self) -> PdParseResult
pub fn protobuf(&self) -> PdParseResult
Get the protobuf-wrapped PostgreSQL statement. The returned structure, PdParseResult,
implements Deref to pg_query::protobuf::ParseResult and can be used to parse the
statement.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl !Send for Statement
impl !Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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