Skip to content

Add serde support to AST structs and enums #183

Closed
@panarch

Description

@panarch

Hello, I found that serde is not applied in this project, so there's no easy way to serialize/deserialize AST nodes.
serde is often quite useful for some cases; considering to parse query and store the result in somewhere, or parsing remotely and send to database over network... etc.

It looks good to add serde as optional like bigdecimal.
then something similar with this below will be added.

# Cargo.toml
serde = { version = "1.0", features = ["derive"], optional = true }

And for every ast/ codes,

#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};

/// Unary operators
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum UnaryOperator {
    Plus,
    Minus,
    Not,
}

How do you think of this? If it is ok, then I'd like to work on this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions