Skip to content

Adding support for PostgreSQL's CustomOperator(String) #1299

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

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 19 additions & 1 deletion src/ast/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@ pub enum BinaryOperator {
/// See [CREATE OPERATOR](https://www.postgresql.org/docs/current/sql-createoperator.html)
/// for more information.
PGCustomBinaryOperator(Vec<String>),
/// PGroonga Full text search by a keyword operator, e.g. `a &@ b` (PGroonga-specific. See <https://pgroonga.github.io/reference/>)
PGroongaFullTextSearch,
/// PGroonga Full text search by easy to use query language operator, e.g. `a &@~ b` (PGroonga-specific. See <https://pgroonga.github.io/reference/>)
PGroongaEasyQuerySearch,
/// PGroonga Similar search operator, e.g. `a &@* b` (PGroonga-specific. See <https://pgroonga.github.io/reference/>)
PGroongaSimilarSearch,
/// PGroonga Advanced search by ECMAScript like query language operator, e.g. `a &` b` (PGroonga-specific. See <https://pgroonga.github.io/reference/>)
PGroongaAdvancedSearch,
/// PGroonga Full text search by an array of keywords operator, e.g. `a &@| b` (PGroonga-specific. See <https://pgroonga.github.io/reference/>)
PGroongaArrayKeywordSearch,
/// PGroonga Full text search by an array of queries in easy to use query language operator, e.g. `a &@~| b` (PGroonga-specific. See <https://pgroonga.github.io/reference/>)
PGroongaArrayQuerySearch,
}

impl fmt::Display for BinaryOperator {
Expand Down Expand Up @@ -295,7 +307,13 @@ impl fmt::Display for BinaryOperator {
BinaryOperator::QuestionPipe => f.write_str("?|"),
BinaryOperator::PGCustomBinaryOperator(idents) => {
write!(f, "OPERATOR({})", display_separated(idents, "."))
}
},
BinaryOperator::PGroongaFullTextSearch => f.write_str("&@"),
BinaryOperator::PGroongaEasyQuerySearch => f.write_str("&@~"),
BinaryOperator::PGroongaSimilarSearch => f.write_str("&@*"),
BinaryOperator::PGroongaAdvancedSearch => f.write_str("&`"),
BinaryOperator::PGroongaArrayKeywordSearch => f.write_str("&@|"),
BinaryOperator::PGroongaArrayQuerySearch => f.write_str("&@~|"),
}
}
}