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 }

# Iterate over the first page of results
data.each do |row|
  puts row[:name]
end
# Retrieve the next page of results
data = data.next if data.next?

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 }

# Iterate over the first page of results
data.each do |row|
  puts row[:name]
end
# Retrieve the next page of results
data = data.next if data.next?

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



62
63
64
# File 'lib/google/cloud/bigquery/time.rb', line 62

def value=(value)
  @value = value
end