class Sequel::Postgres::JSONQueryOp

Object representing json_query calls

Constants

ON_SQL
WRAPPER

Attributes

wrapper[R]

How to handle wrapping of results

Public Class Methods

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

See JSONBaseOp#query for documentation of the options.

Calls superclass method Sequel::Postgres::JSONValueOp::new
     # File lib/sequel/extensions/pg_json_ops.rb
1117 def initialize(expr, path, opts=OPTS)
1118   @wrapper = opts[:wrapper]
1119   super
1120 end

Private Instance Methods

on_sql_value(value) click to toggle source
     # File lib/sequel/extensions/pg_json_ops.rb
1143 def on_sql_value(value)
1144   ON_SQL[value]
1145 end
to_s_append_args_passing(ds, sql) click to toggle source

Also append the optional WRAPPER/OMIT QUOTES fragment

     # File lib/sequel/extensions/pg_json_ops.rb
1135 def to_s_append_args_passing(ds, sql)
1136   super
1137 
1138   if @wrapper
1139     sql << WRAPPER.fetch(@wrapper)
1140   end
1141 end
to_s_append_function_name(ds, sql) click to toggle source
     # File lib/sequel/extensions/pg_json_ops.rb
1130 def to_s_append_function_name(ds, sql)
1131   sql << 'json_query('
1132 end
transform_opts(transformer, opts) click to toggle source

Also handle transforming the wrapper option

     # File lib/sequel/extensions/pg_json_ops.rb
1125 def transform_opts(transformer, opts)
1126   super
1127   opts[:wrapper] = @wrapper
1128 end