Method: Sequel::Postgres::JSONBaseOp#get_text

Defined in:
lib/sequel/extensions/pg_json_ops.rb

#get_text(key) ⇒ Object

Get JSON array element or object field as text. If an array is given, gets the object at the specified path.

json_op.get_text(1) # (json ->> 1)
json_op.get_text('a') # (json ->> 'a')
json_op.get_text(%w'a b') # (json #>> ARRAY['a', 'b'])


306
307
308
309
310
311
312
# File 'lib/sequel/extensions/pg_json_ops.rb', line 306

def get_text(key)
  if is_array?(key)
    json_op(GET_PATH_TEXT, wrap_array(key))
  else
    json_op(GET_TEXT, key)
  end
end