Class: ConceptQL::Nodes::DateRange

Inherits:
Node
  • Object
show all
Defined in:
lib/conceptql/nodes/date_range.rb

Overview

Represents a node that will create a date_range for every person in the database

Accepts two params: start and end formateed as ‘YYYY-MM-DD’ or ‘START’ or ‘END’ ‘START’ represents the first date of data in the data source, ‘END’ represents the last date of data in the data source,

Constant Summary

Constants inherited from Node

Node::KNOWN_TYPES

Instance Attribute Summary

Attributes inherited from Node

#values

Instance Method Summary collapse

Methods inherited from Node

#arguments, #children, #columns, #date_columns, #evaluate, #initialize, #select_it, #stream

Constructor Details

This class inherits a constructor from ConceptQL::Nodes::Node

Instance Method Details

#query(db) ⇒ Object



11
12
13
14
# File 'lib/conceptql/nodes/date_range.rb', line 11

def query(db)
  db.from(:person)
    .select_append(Sequel.expr(start_date(db)).cast(:date).as(:start_date),Sequel.expr(end_date(db)).cast(:date).as(:end_date)).from_self
end

#typesObject



16
17
18
# File 'lib/conceptql/nodes/date_range.rb', line 16

def types
  [:person]
end