Skip to content

Derive macro for implementing TryFrom/TryInto for BoltType #240

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

Open
elimirks opened this issue Apr 9, 2025 · 0 comments
Open

Derive macro for implementing TryFrom/TryInto for BoltType #240

elimirks opened this issue Apr 9, 2025 · 0 comments

Comments

@elimirks
Copy link
Contributor

elimirks commented Apr 9, 2025

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

@elimirks elimirks changed the title Derive macro for implement TryFrom/TryInto for BoltType Derive macro for implementing TryFrom/TryInto for BoltType Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant