phantom icon indicating copy to clipboard operation
phantom copied to clipboard

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

Open rimeh-bennjima opened this issue 4 years ago • 1 comments

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?

rimeh-bennjima avatar Apr 08 '21 16:04 rimeh-bennjima

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.

TRReeve avatar Apr 15 '21 20:04 TRReeve