Class: Sequel::Postgres::JSONExistsOp
- Inherits:
- 
      SQL::Expression
      
        - Object
- SQL::Expression
- Sequel::Postgres::JSONExistsOp
 
- Defined in:
- lib/sequel/extensions/pg_json_ops.rb
Overview
Object representing json_exists calls
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #expr  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Expression (context_item in PostgreSQL terms), usually JSONBaseOp instance. 
- 
  
    
      #on_error  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    How to handle errors when evaluating the JSON path expression. 
- 
  
    
      #passing  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Variables to set in the JSON path expression. 
- 
  
    
      #path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    JSON path expression to apply against the expression. 
Instance Method Summary collapse
- 
  
    
      #initialize(expr, path, opts = OPTS)  ⇒ JSONExistsOp 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    See JSONBaseOp#exists for documentation on the options. 
- 
  
    
      #sequel_ast_transform(transformer)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Support transforming of function call expression. 
- 
  
    
      #to_s_append(ds, sql)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Append the SQL function call expression to the SQL. 
Methods inherited from SQL::Expression
#==, attr_reader, #clone, #eql?, #hash, inherited, #inspect
Constructor Details
#initialize(expr, path, opts = OPTS) ⇒ JSONExistsOp
See JSONBaseOp#exists for documentation on the options.
| 922 923 924 925 926 927 928 | # File 'lib/sequel/extensions/pg_json_ops.rb', line 922 def initialize(expr, path, opts=OPTS) @expr = expr @path = path @passing = opts[:passing] @on_error = opts[:on_error] freeze end | 
Instance Attribute Details
#expr ⇒ Object (readonly)
Expression (context_item in PostgreSQL terms), usually JSONBaseOp instance
| 910 911 912 | # File 'lib/sequel/extensions/pg_json_ops.rb', line 910 def expr @expr end | 
#on_error ⇒ Object (readonly)
How to handle errors when evaluating the JSON path expression
| 919 920 921 | # File 'lib/sequel/extensions/pg_json_ops.rb', line 919 def on_error @on_error end | 
#passing ⇒ Object (readonly)
Variables to set in the JSON path expression
| 916 917 918 | # File 'lib/sequel/extensions/pg_json_ops.rb', line 916 def passing @passing end | 
#path ⇒ Object (readonly)
JSON path expression to apply against the expression
| 913 914 915 | # File 'lib/sequel/extensions/pg_json_ops.rb', line 913 def path @path end | 
Instance Method Details
#sequel_ast_transform(transformer) ⇒ Object
Support transforming of function call expression
| 939 940 941 942 943 | # File 'lib/sequel/extensions/pg_json_ops.rb', line 939 def sequel_ast_transform(transformer) opts = {} transform_opts(transformer, opts) self.class.new(transformer.call(@expr), @path, opts) end | 
#to_s_append(ds, sql) ⇒ Object
Append the SQL function call expression to the SQL
| 931 932 933 934 935 936 | # File 'lib/sequel/extensions/pg_json_ops.rb', line 931 def to_s_append(ds, sql) to_s_append_function_name(ds, sql) to_s_append_args_passing(ds, sql) to_s_append_on_error(ds, sql) sql << ')' end |