Constructor
new AuthorizedView(table, id)
Parameters:
Name | Type | Description |
---|---|---|
table |
Table |
The table that the authorized view exists on. |
id |
string |
Unique identifier of the authorized view. |
Methods
createRules(createRulesInfo, gaxOptionsopt, callback)
Update a row with rules specifying how the row's contents are to be transformed into writes. Rules are applied in order, meaning that earlier rules will affect the results of later ones.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
createRulesInfo |
CreateRulesInformation |
The rules to apply to a row along with the row id of the row to update. |
|||||||||||||
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
Throws:
-
If no rules are provided.
- Type
- error
Example
const row = table.row('samplerow');
// -
// Add an increment amount to an existing value, if the targeted cell is
// unset, it will be treated as containing a zero.
//
const rules = [
{
column: 'follows:gwashington',
increment: 1,
},
];
// -
// You can also create a rule that will append data to an existing value.
// If the targeted cell is unset, it will be treated as a containing an
// empty string.
//
// const rules = [
// {
// column: 'follows:alincoln',
// append: ' Honest Abe!',
// },
// ];
row
.createRules(rules)
.then(result => {
const apiResponse = result[0];
})
.catch(err => {
// Handle the error.
});
increment(columnInfo, valueopt, gaxOptionsopt, callback)
Increment a specific column within the row. If the column does not exist, it is automatically initialized to 0 before being incremented.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
columnInfo |
IncrementInformation |
The column we are incrementing a value in along with the row id of the affected row. |
|||||||||||||||||
value |
number |
<optional> |
The amount to increment by, defaults to 1. |
||||||||||||||||
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||||||
callback |
function |
The callback function. Properties
|
Example
const row = table.row('samplerow');
// Specify a custom amount to increment the column by.
// row
// .increment('follows:gwashington', 2)
// .then(result => {
// let value = result[0];
// let apiResponse = result[1];
// });
// To decrement a column, simply supply a negative value.
// row
// .increment('follows:gwashington', -1)
// .then(result => {
// let value = result[0];
// let apiResponse = result[1];
// });
row
.increment('follows:gwashington')
.then(result => {
const value = result[0];
const apiResponse = result[1];
})
.catch(err => {
// Handle the error.
});