Method: Sequel::SQL::Builders#pg_jsonb
- Defined in:
- lib/sequel/extensions/pg_json.rb
permalink #pg_jsonb(v) ⇒ Object
Wrap the array or hash in a Postgres::JSONBArray or Postgres::JSONBHash. Also handles Postgres::JSONObject and JSONBObjects. For other objects, calls Sequel.pg_json_op
(which is defined by the pg_json_ops extension).
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/sequel/extensions/pg_json.rb', line 554 def pg_jsonb(v) case v when Postgres::JSONBObject v when Array Postgres::JSONBArray.new(v) when Hash Postgres::JSONBHash.new(v) when Postgres::JSONObject v = v.__getobj__ Postgres::JSONDatabaseMethods.jsonb_primitive_wrapper(v).new(v) else Sequel.pg_jsonb_op(v) end end |