I'm using Squeryl 0.9.5-7 and Postgres 9.4 with jsonb datatype and want to insert some data:
case class Log(id: String, meta: String) //meta will contain json
val logs = table[Log]
logs.insert(Log(randomId, "{\"Hi\": \"I'm a json!\"}"))
But got a typecast error that says "Column meta has jsonb type but expression has character varying type. Rewrite expression or convert it's type."
How can I explicitly cast my String
field into jsonb
so that raw sql-parameter will look like ?::jsonb
?
And then, it's interesting how to write json-queries such as @>
or ->>
with Squeryl?