Bigtable v0.3.0 Bigtable.Mutations View Source

Provides functions to build Bigtable mutations that are used when forming row mutation requests.

Link to this section Summary

Functions

Builds a Google.Bigtable.V2.MutateRowsRequest.Entry for use with Google.Bigtable.V2.MutateRowRequest and Google.Bigtable.V2.MutateRowsRequest

Creates a Google.Bigtable.V2.Mutation.DeleteFromColumn given a Google.Bigtable.V2.Mutation, family name, column qualifier, and time range

Creates a Google.Bigtable.V2.Mutation.DeleteFromFamily given a Google.Bigtable.V2.Mutation and family name

Creates a Google.Bigtable.V2.Mutation.DeleteFromRow given a Google.Bigtable.V2.Mutation

Creates a Google.Bigtable.V2.Mutation.SetCell given a Google.Bigtable.V2.Mutation, family name, column qualifier, and timestamp micros

Link to this section Functions

Link to this function

build(row_key) View Source
build(binary()) :: Google.Bigtable.V2.MutateRowsRequest.Entry.t()

Builds a Google.Bigtable.V2.MutateRowsRequest.Entry for use with Google.Bigtable.V2.MutateRowRequest and Google.Bigtable.V2.MutateRowsRequest.

Examples

iex> Bigtable.Mutations.build("Row#123")
%Google.Bigtable.V2.MutateRowsRequest.Entry{mutations: [], row_key: "Row#123"}
Link to this function

delete_from_column(mutation_struct, family, column, time_range \\ []) View Source
delete_from_column(
  Google.Bigtable.V2.MutateRowsRequest.Entry.t(),
  binary(),
  binary(),
  Keyword.t()
) :: Google.Bigtable.V2.MutateRowsRequest.Entry.t()

Creates a Google.Bigtable.V2.Mutation.DeleteFromColumn given a Google.Bigtable.V2.Mutation, family name, column qualifier, and time range.

Time range is a keyword list that should contain optional start_timestamp_micros and end_timestamp_micros. If not provided, start is treated as 0 and end is treated as infinity

Examples

iex> Mutations.build("Row#123") |> Mutations.delete_from_column("family", "column")
%Google.Bigtable.V2.MutateRowsRequest.Entry{
  mutations: [
    %Google.Bigtable.V2.Mutation{
      mutation: {:delete_from_column,
      %Google.Bigtable.V2.Mutation.DeleteFromColumn{
        column_qualifier: "column",
        family_name: "family",
        time_range: %Google.Bigtable.V2.TimestampRange{
          end_timestamp_micros: 0,
          start_timestamp_micros: 0
        }
      }}
    }
  ],
  row_key: "Row#123"
}
Link to this function

delete_from_family(mutation_struct, family) View Source
delete_from_family(Google.Bigtable.V2.MutateRowsRequest.Entry.t(), binary()) ::
  Google.Bigtable.V2.MutateRowsRequest.Entry.t()

Creates a Google.Bigtable.V2.Mutation.DeleteFromFamily given a Google.Bigtable.V2.Mutation and family name.

Examples

iex> Mutations.build("Row#123") |> Mutations.delete_from_family("family")
%Google.Bigtable.V2.MutateRowsRequest.Entry{
  mutations: [
    %Google.Bigtable.V2.Mutation{
      mutation: {:delete_from_family,
      %Google.Bigtable.V2.Mutation.DeleteFromFamily{family_name: "family"}}
    }
  ],
  row_key: "Row#123"
}
Link to this function

delete_from_row(mutation_struct) View Source
delete_from_row(Google.Bigtable.V2.MutateRowsRequest.Entry.t()) ::
  Google.Bigtable.V2.MutateRowsRequest.Entry.t()

Creates a Google.Bigtable.V2.Mutation.DeleteFromRow given a Google.Bigtable.V2.Mutation.

Examples

iex> Mutations.build("Row#123") |> Mutations.delete_from_row()
%Google.Bigtable.V2.MutateRowsRequest.Entry{
  mutations: [
    %Google.Bigtable.V2.Mutation{
      mutation: {:delete_from_row, %Google.Bigtable.V2.Mutation.DeleteFromRow{}}
    }
  ],
  row_key: "Row#123"
}
Link to this function

set_cell(mutation, family, column, value, timestamp \\ -1) View Source
set_cell(
  Google.Bigtable.V2.MutateRowsRequest.Entry.t(),
  binary(),
  binary(),
  binary(),
  integer()
) :: Google.Bigtable.V2.MutateRowsRequest.Entry.t()

Creates a Google.Bigtable.V2.Mutation.SetCell given a Google.Bigtable.V2.Mutation, family name, column qualifier, and timestamp micros.

The provided timestamp corresponds to the timestamp of the cell into which new data should be written. Use -1 for current Bigtable server time. Otherwise, the client should set this value itself, noting that the default value is a timestamp of zero if the field is left unspecified. Values must match the granularity of the table (e.g. micros, millis)

Examples

iex> Mutations.build("Row#123") |> Mutations.set_cell("family", "column", "value")
%Google.Bigtable.V2.MutateRowsRequest.Entry{
  mutations: [
    %Google.Bigtable.V2.Mutation{
      mutation: {:set_cell,
      %Google.Bigtable.V2.Mutation.SetCell{
        column_qualifier: "column",
        family_name: "family",
        timestamp_micros: -1,
        value: "value"
      }}
    }
  ],
  row_key: "Row#123"
}