Class: Google::Cloud::Bigquery::Time

Inherits:
Struct
  • Object
show all
Defined in:
lib/google/cloud/bigquery/time.rb

Overview

Time

A TIME data type represents a time, independent of a specific date.

Examples:

require "google/cloud/bigquery"

bigquery = Google::Cloud::Bigquery.new

fourpm = Google::Cloud::Bigquery::Time.new "16:00:00"
data = bigquery.query "SELECT name " \
                      "FROM `my_project.my_dataset.my_table`" \
                      "WHERE time_of_date = @time",
                      params: { time: fourpm }

data.each do |row|
  puts row[:name]
end

Create Time with fractional seconds:

require "google/cloud/bigquery"

bigquery = Google::Cloud::Bigquery.new

precise_time = Google::Cloud::Bigquery::Time.new "16:35:15.376541"
data = bigquery.query "SELECT name " \
                      "FROM `my_project.my_dataset.my_table`" \
                      "WHERE time_of_date >= @time",
                      params: { time: precise_time }

data.each do |row|
  puts row[:name]
end

Instance Attribute Summary collapse

Instance Attribute Details

#value=(value) ⇒ String (writeonly)

The BigQuery TIME.

Parameters:

  • value (String)

    the value to set the attribute value to.

Returns:

  • (String)

    the newly set value



56
57
58
# File 'lib/google/cloud/bigquery/time.rb', line 56

def value=(value)
  @value = value
end