Sha256: 7173c8be6d9544b2aea2b41d8f8c59b41d2e3d809bf610ae1ba9170f462fa3c4

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

default:
  context:
    node_name: '@node'
    node: 'cleanWater'
    visitor: 'ant'
  src: ''

now:
  src: "nodes where event_at < now"
  sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.event_at < now() AND nodes.parent_id = ? ORDER BY nodes.zip ASC}, @node.id]"

now_interval:
  src: "nodes where created_at > now - 4 days"
  sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.created_at > now() - INTERVAL 4 DAY AND nodes.parent_id = ? ORDER BY nodes.zip ASC}, @node.id]"

year:
  src: "nodes where event_at.year < now.year"
  sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND year(nodes.event_at) < year(now()) AND nodes.parent_id = ? ORDER BY nodes.zip ASC}, @node.id]"

year_on_whatever:
  src: "nodes where id.year < now.year"
  res: '' # no errors

date_tz:
  context:
    date: '2006-04-11 7:0'
    tz: 'Asia/Jakarta'
    # This date is translated to 2006-04-11 0:0 UTC
  src: "nodes where created_at = #{date}"
  res: "crocodiles"

date_tz_day_interval:
  context:
    date: '2006-04-11'
    tz: 'Asia/Jakarta'
    # This date is translated to 2006-04-10 17:0 UTC
  src: "nodes where #{date} <= created_at and created_at < #{date} + 1 day"
  sql: '/INTERVAL 1 DAY/'
  res: "crocodiles"

date_tz_date:
  context:
    date: '2006-04-11'
    tz: 'Asia/Jakarta'
    # This date is translated to 2006-04-10 17:0 UTC
  src: "nodes where created_at.date = #{date}"
  sql: '/INTERVAL 1 DAY/'
  res: "crocodiles"

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
zena-1.2.8 test/integration/query_node/dates.yml
zena-1.2.7 test/integration/query_node/dates.yml
zena-1.2.6 test/integration/query_node/dates.yml
zena-1.2.5 test/integration/query_node/dates.yml
zena-1.2.4 test/integration/query_node/dates.yml
zena-1.2.3 test/integration/query_node/dates.yml
zena-1.2.2 test/integration/query_node/dates.yml
zena-1.2.1 test/integration/query_node/dates.yml
zena-1.2.0 test/integration/query_node/dates.yml