class Sequel::Postgres::JSONExistsOp

Object representing json_exists calls

Attributes

expr[R]

Expression (context_item in PostgreSQL terms), usually JSONBaseOp instance

on_error[R]

How to handle errors when evaluating the JSON path expression

passing[R]

Variables to set in the JSON path expression

path[R]

JSON path expression to apply against the expression

Public Class Methods

new(expr, path, opts=OPTS) click to toggle source

See JSONBaseOp#exists for documentation on the options.

    # File lib/sequel/extensions/pg_json_ops.rb
906 def initialize(expr, path, opts=OPTS)
907   @expr = expr
908   @path = path
909   @passing = opts[:passing]
910   @on_error = opts[:on_error]
911   freeze
912 end

Public Instance Methods

sequel_ast_transform(transformer) click to toggle source

Support transforming of function call expression

    # File lib/sequel/extensions/pg_json_ops.rb
923 def sequel_ast_transform(transformer)
924   opts = {}
925   transform_opts(transformer, opts)
926   self.class.new(transformer.call(@expr), @path, opts)
927 end
to_s_append(ds, sql) click to toggle source

Append the SQL function call expression to the SQL

    # File lib/sequel/extensions/pg_json_ops.rb
915 def to_s_append(ds, sql)
916   to_s_append_function_name(ds, sql)
917   to_s_append_args_passing(ds, sql)
918   to_s_append_on_error(ds, sql)
919   sql << ')'
920 end