Bigtable v0.5.0 Bigtable.RowSet View Source

Provides functions to build a Google.Bigtable.V2.RowSet and apply it to a Google.Bigtable.V2.ReadRowsRequest

Link to this section Summary

Functions

Adds a single or list of row keys to the default Google.Bigtable.V2.ReadRowsRequest

Adds a single or list of row keys to a Google.Bigtable.V2.ReadRowsRequest

Adds a single or list of row ranges to the default Google.Bigtable.V2.ReadRowsRequest with an optional boolean flag to specify the inclusivity of the range start and end

Adds a single or list of row ranges to a Google.Bigtable.V2.ReadRowsRequest with an optional boolean flag to specify the inclusivity of the range start and end

Link to this section Functions

Link to this function

row_keys(keys) View Source
row_keys([binary()]) :: Google.Bigtable.V2.ReadRowsRequest.t()
row_keys(binary()) :: Google.Bigtable.V2.ReadRowsRequest.t()

Adds a single or list of row keys to the default Google.Bigtable.V2.ReadRowsRequest

Returns Google.Bigtable.V2.ReadRowsRequest

Examples

Single Key

iex> request = Bigtable.RowSet.row_keys("Row#123")
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{row_keys: ["Row#123"], row_ranges: []}

Multiple Keys

iex> request = Bigtable.RowSet.row_keys(["Row#123", "Row#124"])
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{row_keys: ["Row#123", "Row#124"], row_ranges: []}
Link to this function

row_keys(request, keys) View Source
row_keys(Google.Bigtable.V2.ReadRowsRequest.t(), [binary()]) ::
  Google.Bigtable.V2.ReadRowsRequest.t()
row_keys(Google.Bigtable.V2.ReadRowsRequest.t(), binary()) ::
  Google.Bigtable.V2.ReadRowsRequest.t()

Adds a single or list of row keys to a Google.Bigtable.V2.ReadRowsRequest

Returns Google.Bigtable.V2.ReadRowsRequest

Examples

Single Key

iex> request = Bigtable.ReadRows.build("table") |> Bigtable.RowSet.row_keys("Row#123")
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{row_keys: ["Row#123"], row_ranges: []}

Multiple Keys

iex> request = Bigtable.ReadRows.build("table") |> Bigtable.RowSet.row_keys(["Row#123", "Row#124"])
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{row_keys: ["Row#123", "Row#124"], row_ranges: []}
Link to this function

row_ranges(ranges) View Source
row_ranges(
  [{binary(), binary(), binary()}]
  | [{binary(), binary()}]
  | [{binary(), binary(), binary()}]
  | {binary(), binary(), binary()}
) :: Google.Bigtable.V2.ReadRowsRequest.t()

Adds a single or list of row ranges to the default Google.Bigtable.V2.ReadRowsRequest with an optional boolean flag to specify the inclusivity of the range start and end.

Row ranges should be provided in the format {start, end} or {start, end, inclusive}.

Returns Google.Bigtable.V2.ReadRowsRequest

Examples

Single Range

iex> request = Bigtable.RowSet.row_ranges({"start", "end"})
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{
  row_keys: [],
  row_ranges: [
    %Google.Bigtable.V2.RowRange{
      end_key: {:end_key_closed, "end"},
      start_key: {:start_key_closed, "start"}
    }
  ]
}

Multiple Ranges

iex> ranges = [{"start1", "end1"}, {"start2", "end2", false}]
iex> request = Bigtable.RowSet.row_ranges(ranges)
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{
  row_keys: [],
  row_ranges: [
      %Google.Bigtable.V2.RowRange{
      end_key: {:end_key_closed, "end1"},
      start_key: {:start_key_closed, "start1"}
    },
    %Google.Bigtable.V2.RowRange{
      end_key: {:end_key_open, "end2"},
      start_key: {:start_key_open, "start2"}
    }
  ]
}
Link to this function

row_ranges(request, ranges) View Source
row_ranges(
  Google.Bigtable.V2.ReadRowsRequest.t(),
  [{binary(), binary(), binary()}]
  | [{binary(), binary()}]
  | [{binary(), binary(), binary()}]
  | {binary(), binary(), binary()}
) :: Google.Bigtable.V2.ReadRowsRequest.t()

Adds a single or list of row ranges to a Google.Bigtable.V2.ReadRowsRequest with an optional boolean flag to specify the inclusivity of the range start and end.

Row ranges should be provided in the format {start, end} or {start, end, inclusive}.

Returns Google.Bigtable.V2.ReadRowsRequest

Examples

Single Range

iex> request = Bigtable.ReadRows.build("table") |> Bigtable.RowSet.row_ranges({"start", "end"})
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{
  row_keys: [],
  row_ranges: [
    %Google.Bigtable.V2.RowRange{
      end_key: {:end_key_closed, "end"},
      start_key: {:start_key_closed, "start"}
    }
  ]
}

Multiple Ranges

iex> ranges = [{"start1", "end1"}, {"start2", "end2", false}]
iex> request = Bigtable.ReadRows.build("table") |> Bigtable.RowSet.row_ranges(ranges)
iex> with %Google.Bigtable.V2.ReadRowsRequest{} <- request, do: request.rows
%Google.Bigtable.V2.RowSet{
  row_keys: [],
  row_ranges: [
      %Google.Bigtable.V2.RowRange{
      end_key: {:end_key_closed, "end1"},
      start_key: {:start_key_closed, "start1"}
    },
    %Google.Bigtable.V2.RowRange{
      end_key: {:end_key_open, "end2"},
      start_key: {:start_key_open, "start2"}
    }
  ]
}