Skip to content
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

Transformation of Temporal type #122

Open
bboure opened this issue Dec 18, 2019 · 2 comments
Open

Transformation of Temporal type #122

bboure opened this issue Dec 18, 2019 · 2 comments
Labels
Milestone

Comments

@bboure
Copy link
Contributor

bboure commented Dec 18, 2019

Hi,

I am experimenting with this package and it all looks promising. Thank you for the hard work!

I am running across a small issue though.
I am using neo4j date() and datetime() types in some properties.

When getting the result back from neo4j in a query, those properties come back as instances of neo4jDriver.v1.types.Date and neo4jDriver.v1.types.DateTime (see Temporal types).

However, when going through the transformer, they get transformed into standard objects here.

This means that I cannot use neo4jDriver.v1.isDate or neo4jDriver.v1.isDateTime anymore on them later on in my code for custom handling (in my case I use them to determine how to format them).

I would expect the transformer to either:

  • transform them into a Date object
  • return a formatted string (based on the type)
  • return them as-is

In fact, I am thinking that it would also be great to be able to inject a custom Transformer into the Connection. That would allow custom transformations.
In the case of date objects, it might be useful for localization, for example.

I haven't tested yet, but similar issues will likely happen with Duration, Type, Localtime, Point, etc.
See also https://neo4j.com/docs/driver-manual/1.7/cypher-values/#driver-neo4j-type-system

What do you think?

Thanks you

@jamesfer
Copy link
Owner

Hi there. Thanks for raising this issue. I think returning them as is may be the best solution. This will be considered a breaking change though so it will be part of the next major release.
I'll see what I can do about the custom transformer, other people have raised the same suggestion so it can probably be part of the same release.

@bboure
Copy link
Contributor Author

bboure commented Dec 19, 2019

Great. Thank you.

@jamesfer jamesfer added this to the v6 milestone Dec 20, 2019
@jamesfer jamesfer mentioned this issue Mar 9, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants