Skip to content

Commit

Permalink
Release 5.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
seanlinsley committed Oct 17, 2024
1 parent 37e6690 commit 27fe8fa
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
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-17

* 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

0 comments on commit 27fe8fa

Please sign in to comment.