Cloud Bigtable API - Class Google::Cloud::Bigtable::ColumnRange (v2.8.0)

Reference documentation and code samples for the Cloud Bigtable API class Google::Cloud::Bigtable::ColumnRange.

ColumnRange

Specifies a contiguous range of column qualifiers.

  • Start qualifier bound : The qualifier at which to start the range. If neither field is set, interpreted as the empty string, inclusive.
  • End qualifier bound: The qualifier at which to end the range. If neither field is set, interpreted as the infinite string qualifier, exclusive.

Inherits

  • Object

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")

Methods

#between

def between(from_qualifier, to_qualifier) -> Google::Cloud::Bigtable::ColumnRange

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

Parameters
  • from_qualifier (String) — Inclusive from qualifier. Required.
  • to_qualifier (String) — Inclusive to qualifier. Required.
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")

#family

def family() -> String

Gets the column family name.

Returns
  • (String)

#family=

def family=(name)

Sets the column family name.

Parameter
  • name (String) — Column family name

#from

def from(qualifier, inclusive: true) -> Google::Cloud::Bigtable::ColumnRange

Sets the column range with the lower bound.

Parameters
  • qualifier (String) — Column qualifier name. Required
  • inclusive (String) (defaults to: true) — Lower bound flag. Inclusive/Exclusive. Default is an inclusive lower bound.
Examples

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")

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)

#initialize

def initialize(family) -> ColumnRange

Create qualifier range instance.

Parameter
  • family (String) — Column family name.
Returns

#of

def of(from_qualifier, to_qualifier) -> Google::Cloud::Bigtable::ColumnRange

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

Parameters
  • from_qualifier (String) — Inclusive from qualifier
  • to_qualifier (String) — Exclusive to qualifier
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")

#to

def to(qualifier, inclusive: false) -> Google::Cloud::Bigtable::ColumnRange

Sets the column range with the upper bound.

Parameters
  • qualifier (String) — Column qualifier name. Required.
  • inclusive (String) (defaults to: false) — Upper bound flag. Inclusive/Exclusive. Default is an inclusive upper bound.
Examples

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)

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")