Class Mutation (3.6.0)

Formats table mutations to be in the expected proto format.

Package

@google-cloud/bigtable!

Constructors

(constructor)(mutation)

  constructor 
 ( 
 mutation 
 : 
  
 MutationConstructorObj 
 ); 
 

Constructs a new instance of the Mutation class

Parameter
Name Description
mutation MutationConstructorObj

Properties

data

  data 
 : 
  
 Data 
 ; 
 
Property Value
Type Description
Data

key

  key 
 : 
  
 string 
 ; 
 
Property Value
Type Description
string

method

  method 
 : 
  
 string 
 ; 
 
Property Value
Type Description
string

methods

  static 
  
 methods 
 : 
  
 { 
  
 INSERT 
 : 
  
 string 
 ; 
  
 DELETE 
 : 
  
 string 
 ; 
  
 }; 
 

Mutation methods

INSERT => setCell DELETE => deleteFrom*

Property Value
Type Description
{ INSERT: string; DELETE: string; }

Methods

convertFromBytes(bytes, options)

  static 
  
 convertFromBytes 
 ( 
 bytes 
 : 
  
 Buffer 
  
 | 
  
 string 
 , 
  
 options 
 ?: 
  
 ConvertFromBytesOptions 
 ) 
 : 
  
 Buffer 
  
 | 
  
 Value 
  
 | 
  
 string 
 ; 
 

Parses "bytes" returned from proto service.

Parameters
Name Description
bytes Buffer | string

Base64 encoded string.

options ConvertFromBytesOptions

Options to device return types

Returns
Type Description
Buffer | Value | string

{string|number|buffer}

convertToBytes(data)

  static 
  
 convertToBytes 
 ( 
 data 
 : 
  
 Buffer 
  
 | 
  
 Data 
 ) 
 : 
  
 Buffer 
  
 | 
  
 Data 
 ; 
 

Converts data into a buffer for proto service.

Parameter
Name Description
data Buffer | Data

The data to be sent.

Returns
Type Description
Buffer | Data

{buffer}

createTimeRange(start, end)

  static 
  
 createTimeRange 
 ( 
 start 
 : 
  
 Date 
  
 | 
  
 number 
 , 
  
 end 
 : 
  
 Date 
  
 | 
  
 number 
 ) 
 : 
  
 TimeRange 
 ; 
 

Takes date objects and creates a time range.

Parameters
Name Description
start Date | number

The start date.

end Date | number

The end date.

Returns
Type Description
TimeRange

{object}

encodeDelete(data)

  static 
  
 encodeDelete 
 ( 
 data 
 ?: 
  
 Data 
  
 | 
  
 Data 
 []) 
 : 
  
 IMutation 
 []; 
 

Formats a delete mutation to what the proto service expects. Depending on what data is supplied to this method, it will return an object that can will do one of the following:

* Delete specific cells from a column. * Delete all cells contained with a specific family. * Delete all cells from an entire rows.

Parameter
Name Description
data Data | Data []

The entry data.

Returns
Type Description
IMutation []

{object}

encodeSetCell(data)

  static 
  
 encodeSetCell 
 ( 
 data 
 : 
  
 Data 
 ) 
 : 
  
 SetCellObj 
 []; 
 

Formats an insert mutation to what the proto service expects.

Parameter
Name Description
data Data

The entity data.

Returns
Type Description
SetCellObj []

{object[]}

parse(mutation)

  static 
  
 parse 
 ( 
 mutation 
 : 
  
 Mutation 
 ) 
 : 
  
 IMutateRowRequest 
 ; 
 

Creates a new Mutation object and returns the proto JSON form.

Parameter
Name Description
mutation Mutation

The entity data.

Returns
Type Description
IMutateRowRequest

{object}

parseColumnName(columnName)

  static 
  
 parseColumnName 
 ( 
 columnName 
 : 
  
 string 
 ) 
 : 
  
 ParsedColumn 
 ; 
 

Parses a column name into an object.

Parameter
Name Description
columnName string
Returns
Type Description
ParsedColumn

{object}

toProto()

  toProto 
 () 
 : 
  
 IMutateRowRequest 
 ; 
 

Converts the mutation object into proto friendly JSON.

Returns
Type Description
IMutateRowRequest

{object}

Create a Mobile Website
View Site in Mobile | Classic
Share by: