module Clear::SQL::JSONB

Extended Modules

Direct including types

Defined in:

clear/extensions/jsonb/jsonb.cr

Instance Method Summary

Instance Method Detail

def jsonb_all_exists?(field, keys : Array(String)) #

jsonb ?& operator Do all of these array strings exist as top-level keys?


[View source]
def jsonb_any_exists?(field, keys : Array(String)) #

jsonb ?| operator Do any of these array strings exist as top-level keys?


[View source]
def jsonb_eq(field, key, value) #

Test equality using the @> operator

jsonb_eq("data.sub.key", "value")

=> data @> '{"sub": {"key": "value"}}'


[View source]
def jsonb_exists?(field, value) #

Does the string exist as a top-level key within the JSON value?


[View source]
def jsonb_k2h(key : String, value : JSONBKey) : JSONBHash #

Transform a key to a hash


[View source]
def jsonb_resolve(field, arr : Array(String), cast = nil) : String #

[View source]
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%'"

[View source]