Module: Predicate::Postgres::ToSequel

Included in:
ToSequel
Defined in:
lib/predicate/postgres/ext/to_sequel.rb

Instance Method Summary collapse

Instance Method Details

#on_pg_array_empty(sexpr) ⇒ Object



15
16
17
18
19
# File 'lib/predicate/postgres/ext/to_sequel.rb', line 15

def on_pg_array_empty(sexpr)
  left = PgArray.to_pg_array(apply(sexpr.operand))
  right = PgArray.to_pg_array([], sexpr.last)
  ::Sequel.expr(left => right)
end

#on_pg_array_literal(sexpr) ⇒ Object



4
5
6
# File 'lib/predicate/postgres/ext/to_sequel.rb', line 4

def on_pg_array_literal(sexpr)
  PgArray.to_pg_array(sexpr[1], sexpr[2])
end

#on_pg_array_overlaps(sexpr) ⇒ Object



8
9
10
11
12
13
# File 'lib/predicate/postgres/ext/to_sequel.rb', line 8

def on_pg_array_overlaps(sexpr)
  type = sexpr.last
  l = PgArray.to_pg_array(apply(sexpr.left), type)
  r = PgArray.to_pg_array(apply(sexpr.right), type)
  l.overlaps(r)
end