Open litek opened 10 years ago
:+1:
I like your first method signature, how about the following?
customer.select(customer.metadata.key('age'))
# SELECT ("customer"."metadata" -> 'age') FROM "customer"
customer.select(customer.metadata.keyText('age'))
# SELECT ("customer"."metadata" ->> 'age') FROM "customer"
customer.select(customer.metadata.path('{address,city}'))
# SELECT ("customer"."metadata" #> '{address,city}') FROM "customer"
customer.select(customer.metadata.pathText('{address,city}'))
# SELECT ("customer"."metadata" #>> '{address,city}') FROM "customer"
This should be closed due to #151, correct?
Currently only -> is supported through column.key(). It would be great if ->>, #> and #>> could be added, I'm not entirely sure what would be a good name for them though.
Perhaps something like: ->> text(key)
> path([keys])
>> pathText([keys])
Or maybe: -> key(key) ->> key(key).text()
> path([keys])
>> path([keys]).text()
Ref: http://www.postgresql.org/docs/9.3/static/functions-json.html