class Google::Cloud::Bigtable::Row::Cell

Cell

Row cell built from data chunks.

Attributes

family[R]
labels[R]
qualifier[R]
timestamp[R]
value[R]

Public Class Methods

new(family, qualifier, timestamp, value, labels = []) click to toggle source

Creates a row cell instance.

@param family [String] Column family name. @param qualifier [String] Column cell qualifier name. @param timestamp [Integer] Timestamp in microseconds. @param value [String] Cell value. @param labels [Array<String>] List of label array.

# File lib/google/cloud/bigtable/row.rb, line 48
def initialize family, qualifier, timestamp, value, labels = []
  @family = family
  @qualifier = qualifier
  @timestamp = timestamp
  @value = value
  @labels = labels
end

Public Instance Methods

==(other) click to toggle source

@private

Cell object comparator.

@return [Boolean]

# File lib/google/cloud/bigtable/row.rb, line 85
def == other
  return false unless self.class == other.class

  instance_variables.all? do |var|
    instance_variable_get(var) == other.instance_variable_get(var)
  end
end
to_i() click to toggle source

Converts a value to an integer.

@return [Integer]

# File lib/google/cloud/bigtable/row.rb, line 75
def to_i
  @value.unpack1 "q>"
end
to_time(granularity = nil) click to toggle source

Converts timestamp to Time instance.

@param granularity [Symbol] Optional.

Valid granularity types are `:micros`, `:millis`.
Default is `:millis`.

@return [Time | nil]

# File lib/google/cloud/bigtable/row.rb, line 64
def to_time granularity = nil
  return nil if @timestamp.zero?
  return Time.at @timestamp / 1_000_000.0 if granularity == :micros
  Time.at @timestamp / 1000.0
end