Skip to content

Derive macro for implementing TryFrom/TryInto for BoltType #240

Open
@elimirks

Description

@elimirks

Since cypher core types are isomorphic to JSON, it should be doable to implement something like #[derive(Serialize, Deserialize)] for BoltType.

The core types have pretty obvious translations.

ByteArray:

  • Bytes or
  • [u8] or
  • Vec<u8>

int:

  • i64 or
  • i32 or
  • u32
  • etc etc

(notable, maybe no u64 for int since the JVM doesn't support u64, so I assume Neo4j doesn't either)

Spatial and graph types have less obvious translations into Rust, and maybe we could have a "sub-derive" similar to #[serde(serialize_with = ...)]. Temporal types can like likely map to std::time or an optional chrono dependency.

I'm writing this here because it's something my team talked about implementing internally, but thought it would make since to contribute to the OSS project. It's not super high priority for us but we want to eventually implement it.

Let me know if this makes more sense as a separate crate

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