Skip to content

Commit 47ea5d4

Browse files
Resolved issues regarding serde derive
1 parent 30c20f8 commit 47ea5d4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/ast/operator_classes.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
use core::fmt::{self, Display};
1919

20+
#[cfg(feature = "serde")]
21+
use serde::{Deserialize, Serialize};
22+
#[cfg(feature = "visitor")]
23+
use sqlparser_derive::{Visit, VisitMut};
24+
2025
use crate::keywords::Keyword;
2126

2227
/// Trait characterizing the operator classes
@@ -27,6 +32,7 @@ pub trait OperatorClass: From<Keyword> + Into<IndexOperatorClass> {
2732

2833
/// Bloom-index specific operator classes
2934
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
35+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
3036
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
3137
pub enum BloomOperatorClass {
3238
Int4,
@@ -58,6 +64,7 @@ impl Display for BloomOperatorClass {
5864

5965
/// BTree GIN-based index operator class
6066
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
67+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6168
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
6269
pub enum GINOperatorClass {
6370
Int2,
@@ -210,6 +217,7 @@ impl Display for GINOperatorClass {
210217

211218
/// BTree GIST-based index operator class
212219
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
220+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
213221
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
214222
pub enum GiSTOperatorClass {
215223
OID,
@@ -365,6 +373,7 @@ impl Display for GiSTOperatorClass {
365373

366374
/// BTree-index specific operator classes
367375
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
376+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
368377
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
369378
pub enum BTreeOperatorClass {
370379
/// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html)
@@ -444,6 +453,7 @@ impl Display for BTreeOperatorClass {
444453

445454
/// Hash-index specific operator classes
446455
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
456+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
447457
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
448458
pub enum HashOperatorClass {
449459
/// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html)

src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ enum ParserState {
274274
ConnectBy,
275275
}
276276

277-
#[derive(Debug)]
277+
#[cfg_attr(feature = "std", derive(Debug))]
278278
/// A SQL Parser
279279
///
280280
/// This struct is the main entry point for parsing SQL queries.

0 commit comments

Comments
 (0)