Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.1.1 #46

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
.idea/
.DS_Store
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 5.1.1 2024-10-30

* Make `ParseResult` struct public and implement `Debug`

## 5.1.0 2024-01-09

* Update to libpg_query 16-5.1.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "pg_query"
description = "PostgreSQL parser that uses the actual PostgreSQL server source to parse SQL queries and return the internal PostgreSQL parse tree."
version = "5.1.0"
version = "5.1.1"
edition = "2021"
documentation = "https://docs.rs/pg_query/"
build = "build.rs"
Expand Down
6 changes: 5 additions & 1 deletion src/parse_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ impl protobuf::ParseResult {
}
}

/// Result from calling [parse]
#[derive(Debug)]
pub struct ParseResult {
pub protobuf: protobuf::ParseResult,
pub warnings: Vec<String>,
Expand Down Expand Up @@ -215,7 +217,7 @@ impl ParseResult {
.collect()
}

/// Returns any references to tables in the query
/// Returns all function references
pub fn functions(&self) -> Vec<String> {
let mut functions = HashSet::new();
self.functions.iter().for_each(|(f, _c)| {
Expand Down Expand Up @@ -246,6 +248,7 @@ impl ParseResult {
.collect()
}

/// Converts the parsed query back into a SQL string
pub fn deparse(&self) -> Result<String> {
crate::deparse(&self.protobuf)
}
Expand All @@ -263,6 +266,7 @@ impl ParseResult {
crate::truncate(&self.protobuf, max_length)
}

/// Returns all statement types in the query
pub fn statement_types(&self) -> Vec<&str> {
self.protobuf
.stmts
Expand Down
Loading