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

How can I Insert a date of type Instant in cassandra database with phantom ? #929

Open
rimeh-bennjima opened this issue Apr 8, 2021 · 1 comment

Comments

@rimeh-bennjima
Copy link

I want to insert a value of type Instant in db cassandra with phantom .
I have the time:

import java.util.Instant
val time = Instant.now()
2020-12-02T15:40:55.197408Z

I found in db the value : 2020-12-02T15:40:55.197Z
why the value change in cassandra? is it possible to insert the same created value?

@TRReeve
Copy link

TRReeve commented Apr 15, 2021

If you can't represent your Instant in the exact way you want using standard datetimes etc then it's pretty doable to define a custom function for serializing to some other representation (e.g String/Bytes) and then override the "fromRow" function in your Table definition so you can read a row of data back into your application as whatever data type you have.

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

2 participants