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 1109 def initialize(expr, path, opts=OPTS) 1110 @wrapper = opts[:wrapper] 1111 super 1112 end
Private Instance Methods
on_sql_value(value)
click to toggle source
# File lib/sequel/extensions/pg_json_ops.rb 1135 def on_sql_value(value) 1136 ON_SQL[value] 1137 end
to_s_append_args_passing(ds, sql)
click to toggle source
Also append the optional WRAPPER/OMIT QUOTES fragment
Calls superclass method
Sequel::Postgres::JSONValueOp#to_s_append_args_passing
# File lib/sequel/extensions/pg_json_ops.rb 1127 def to_s_append_args_passing(ds, sql) 1128 super 1129 1130 if @wrapper 1131 sql << WRAPPER.fetch(@wrapper) 1132 end 1133 end
to_s_append_function_name(ds, sql)
click to toggle source
# File lib/sequel/extensions/pg_json_ops.rb 1122 def to_s_append_function_name(ds, sql) 1123 sql << 'json_query(' 1124 end
transform_opts(transformer, opts)
click to toggle source
Also handle transforming the wrapper option
Calls superclass method
Sequel::Postgres::JSONValueOp#transform_opts
# File lib/sequel/extensions/pg_json_ops.rb 1117 def transform_opts(transformer, opts) 1118 super 1119 opts[:wrapper] = @wrapper 1120 end