pub struct ParseResult {
pub protobuf: ParseResult,
pub warnings: Vec<String>,
pub tables: Vec<(String, Context)>,
pub aliases: HashMap<String, String>,
pub cte_names: Vec<String>,
pub functions: Vec<(String, Context)>,
pub filter_columns: Vec<(Option<String>, String)>,
}
Expand description
Result from calling parse
Fields§
§protobuf: ParseResult
§warnings: Vec<String>
§tables: Vec<(String, Context)>
§aliases: HashMap<String, String>
§cte_names: Vec<String>
§functions: Vec<(String, Context)>
§filter_columns: Vec<(Option<String>, String)>
Implementations§
Source§impl ParseResult
impl ParseResult
pub fn new(protobuf: ParseResult, stderr: String) -> Self
Sourcepub fn select_tables(&self) -> Vec<String>
pub fn select_tables(&self) -> Vec<String>
Returns only tables that were selected from
Sourcepub fn dml_tables(&self) -> Vec<String>
pub fn dml_tables(&self) -> Vec<String>
Returns only tables that were modified by the query
Sourcepub fn ddl_tables(&self) -> Vec<String>
pub fn ddl_tables(&self) -> Vec<String>
Returns only tables that were modified by DDL statements
Sourcepub fn ddl_functions(&self) -> Vec<String>
pub fn ddl_functions(&self) -> Vec<String>
Returns DDL functions
Sourcepub fn call_functions(&self) -> Vec<String>
pub fn call_functions(&self) -> Vec<String>
Returns functions that were called
Sourcepub fn truncate(&self, max_length: usize) -> Result<String>
pub fn truncate(&self, max_length: usize) -> Result<String>
Intelligently truncates queries to a max length.
§Example
let query = "INSERT INTO \"x\" (a, b, c, d, e, f) VALUES ($1)";
let result = pg_query::parse(query).unwrap();
assert_eq!(result.truncate(32).unwrap(), "INSERT INTO x (...) VALUES (...)")
Sourcepub fn statement_types(&self) -> Vec<&str>
pub fn statement_types(&self) -> Vec<&str>
Returns all statement types in the query
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParseResult
impl RefUnwindSafe for ParseResult
impl Send for ParseResult
impl Sync for ParseResult
impl Unpin for ParseResult
impl UnwindSafe for ParseResult
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