class Sequel::Postgres::JSONHash

  1. lib/sequel/extensions/pg_json.rb
  2. lib/sequel/extensions/pg_json_ops.rb
  3. show all
Parent: Postgres

Class representating PostgreSQL JSON column hash/object values.

Methods

Public Instance

  1. op
  2. sql_literal_append

Included modules

  1. Sequel::SQL::AliasMethods

Public Instance methods

op ()

Wrap the JSONHash instance in an JSONOp, allowing you to easily use the PostgreSQL json functions and operators with literal jsons.

[show source]
# File lib/sequel/extensions/pg_json_ops.rb, line 218
def op
  JSONOp.new(self)
end
sql_literal_append (ds, sql)

Convert the hash to a json string, append a literalized version of the string to the sql, and explicitly cast the string to json.

[show source]
# File lib/sequel/extensions/pg_json.rb, line 85
def sql_literal_append(ds, sql)
  ds.literal_append(sql, Sequel.object_to_json(self))
  sql << CAST_JSON
end