Files

Class/Module Index [+]

Quicksearch

Sequel::Postgres::JSONBOp

JSONBaseOp subclass for the jsonb type.

In the method documentation examples, assume that:

jsonb_op = Sequel.pg_jsonb(:jsonb)

Public Instance Methods

contain_all(other) click to toggle source

Check if the receiver contains all of the keys in the given array:

jsonb_op.contain_all(:a) # (jsonb ?& a)
# File lib/sequel/extensions/pg_json_ops.rb, line 270
def contain_all(other)
  bool_op(CONTAIN_ALL, wrap_input_array(other))
end
contain_any(other) click to toggle source

Check if the receiver contains any of the keys in the given array:

jsonb_op.contain_any(:a) # (jsonb ?| a)
# File lib/sequel/extensions/pg_json_ops.rb, line 277
def contain_any(other)
  bool_op(CONTAIN_ANY, wrap_input_array(other))
end
contained_by(other) click to toggle source

Check if the other jsonb contains all entries in the receiver:

jsonb_op.contained_by(:h) # (jsonb <@ h)
# File lib/sequel/extensions/pg_json_ops.rb, line 291
def contained_by(other)
  bool_op(CONTAINED_BY, wrap_input_jsonb(other))
end
contains(other) click to toggle source

Check if the receiver contains all entries in the other jsonb:

jsonb_op.contains(:h) # (jsonb @> h)
# File lib/sequel/extensions/pg_json_ops.rb, line 284
def contains(other)
  bool_op(CONTAINS, wrap_input_jsonb(other))
end
has_key?(key) click to toggle source

Check if the receiver contains the given key:

jsonb_op.has_key?('a') # (jsonb ? 'a')
# File lib/sequel/extensions/pg_json_ops.rb, line 298
def has_key?(key)
  bool_op(HAS_KEY, key)
end
Also aliased as: include?
include?(key) click to toggle source
Alias for: has_key?
pg_jsonb() click to toggle source

Return the receiver, since it is already a JSONBOp.

# File lib/sequel/extensions/pg_json_ops.rb, line 304
def pg_jsonb
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.