kclay / rethink-scala

Scala Driver for RethinkDB
Other
100 stars 24 forks source link

Typeclass-based model? #29

Closed 4lex1v closed 9 years ago

4lex1v commented 9 years ago

As i can see from the README example, ATM the only way to marshal my date into something that can be stored is to extend the Document type. Is there any way to do this using typeclasses? Or at least write a converter Model <-> Rethink Document?

kclay commented 9 years ago

You don't have to extend Document anymore, you can do

case class MyModel(date:DateTime)

r.table[MyModel].insert(MyModel(DateTime.now())).run 

Use 0.4.7-SNAPSHOT, would this work for your case?