module Clear::SQL::JSONB
Extended Modules
Direct including types
Defined in:
clear/extensions/jsonb/jsonb.crInstance Method Summary
-
#jsonb_all_exists?(field, keys : Array(String))
jsonb
?&
operator Do all of these array strings exist as top-level keys? -
#jsonb_any_exists?(field, keys : Array(String))
jsonb
?|
operator Do any of these array strings exist as top-level keys? -
#jsonb_eq(field, key, value)
Test equality using the
@>
operator -
#jsonb_exists?(field, value)
Does the string exist as a top-level key within the JSON value?
-
#jsonb_k2h(key : String, value : JSONBKey) : JSONBHash
Transform a key to a hash
- #jsonb_resolve(field, arr : Array(String), cast = nil) : String
-
#jsonb_resolve(field, key : String, cast = nil)
Return text selector for the field/key :
Instance Method Detail
def jsonb_all_exists?(field, keys : Array(String))
#
jsonb ?&
operator
Do all of these array strings exist as top-level keys?
def jsonb_any_exists?(field, keys : Array(String))
#
jsonb ?|
operator
Do any of these array strings exist as top-level keys?
def jsonb_eq(field, key, value)
#
Test equality using the @>
operator
jsonb_eq("data.sub.key", "value")
=> data @> '{"sub": {"key": "value"}}'
def jsonb_resolve(field, key : String, cast = nil)
#
Return text selector for the field/key :
jsonb_text("data", "sub.key").like("user%")
# => "data->'sub'->>'key' LIKE 'user%'"