class Google::Cloud::Bigtable::ColumnRange

# ColumnRange

Specifies a contiguous range of column qualifiers.

@example

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
table = bigtable.table "my-instance", "my-table"

# Range that includes all qualifiers including "user-001" up until "user-010"
table.new_column_range("cf").from("user-001").to("user-010")

# Range that includes all qualifiers including "user-001" up to and including "user-005"
table.new_column_range("cf").from("user-001").to("user-005", inclusive: true)

# Range that includes all qualifiers until end of the row key "user-001".
table.new_column_range("cf").to("user-010") # exclusive

# Range with unbounded start and the inclusive end "user-100"
table.new_column_range("cf").to("user-100", inclusive: true)

# Range that includes all qualifiers including "user-001" up to and including "user-100"
table.new_column_range("cf").between("user-001", "user-100")

Public Class Methods

new(family) click to toggle source

Create qualifier range instance.

@param family [String] Column family name.

# File lib/google/cloud/bigtable/column_range.rb, line 58
def initialize family
  @grpc = Google::Cloud::Bigtable::V2::ColumnRange.new family_name: family
end

Public Instance Methods

between(from_qualifier, to_qualifier) click to toggle source

Sets the column range with the inclusive upper and lower bound.

@param from_qualifier [String] Inclusive from qualifier. Required. @param to_qualifier [String] Inclusive to qualifier. Required. @return [Google::Cloud::Bigtable::ColumnRange]

@example

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
table = bigtable.table "my-instance", "my-table"

table.new_column_range("cf").between("qualifier-1", "qualifier-10")
# File lib/google/cloud/bigtable/column_range.rb, line 161
def between from_qualifier, to_qualifier
  from(from_qualifier).to(to_qualifier, inclusive: true)
end
family() click to toggle source

Gets the column family name.

@return [String]

# File lib/google/cloud/bigtable/column_range.rb, line 67
def family
  @grpc.family_name
end
family=(name) click to toggle source

Sets the column family name.

@param name [String] Column family name

# File lib/google/cloud/bigtable/column_range.rb, line 76
def family= name
  @grpc.family_name = name
end
from(qualifier, inclusive: true) click to toggle source

Sets the column range with the lower bound.

@param qualifier [String] Column qualifier name. Required @param inclusive [String] Lower bound flag. Inclusive/Exclusive.

Default is an inclusive lower bound.

@return [Google::Cloud::Bigtable::ColumnRange]

@example Inclusive lower bound.

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
table = bigtable.table "my-instance", "my-table"

table.new_column_range("cf").from("qualifier-1")

@example Exclusive lower bound.

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
table = bigtable.table "my-instance", "my-table"

table.new_column_range("cf").from("qualifier-1", inclusive: false)
# File lib/google/cloud/bigtable/column_range.rb, line 104
def from qualifier, inclusive: true
  if inclusive
    @grpc.start_qualifier_closed = qualifier
  else
    @grpc.start_qualifier_open = qualifier
  end
  self
end
of(from_qualifier, to_qualifier) click to toggle source

Sets the column range with the inclusive upper and the exclusive lower bound.

@param from_qualifier [String] Inclusive from qualifier @param to_qualifier [String] Exclusive to qualifier @return [Google::Cloud::Bigtable::ColumnRange]

@example

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
table = bigtable.table "my-instance", "my-table"

table.new_column_range("cf").of("qualifier-1", "qualifier-10")
# File lib/google/cloud/bigtable/column_range.rb, line 180
def of from_qualifier, to_qualifier
  from(from_qualifier).to(to_qualifier)
end
to(qualifier, inclusive: false) click to toggle source

Sets the column range with the upper bound.

@param qualifier [String] Column qualifier name. Required. @param inclusive [String] Upper bound flag. Inclusive/Exclusive.

Default is an inclusive upper bound.

@return [Google::Cloud::Bigtable::ColumnRange]

@example Inclusive upper bound.

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
table = bigtable.table "my-instance", "my-table"

table.new_column_range("cf").to("qualifier-10", inclusive: true)

@example Exclusive upper bound.

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
table = bigtable.table "my-instance", "my-table"

table.new_column_range("cf").to("qualifier-10")
# File lib/google/cloud/bigtable/column_range.rb, line 137
def to qualifier, inclusive: false
  if inclusive
    @grpc.end_qualifier_closed = qualifier
  else
    @grpc.end_qualifier_open = qualifier
  end
  self
end
to_grpc() click to toggle source

@private

@return [Google::Cloud::Bigtable::V2::ColumnRange]

# File lib/google/cloud/bigtable/column_range.rb, line 188
def to_grpc
  @grpc
end