Skip to content

Commit

Permalink
Cleanup Spanner region tags. (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry authored and stephenplusplus committed Mar 1, 2018
1 parent 2857101 commit 04283e8
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
20 changes: 10 additions & 10 deletions samples/crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'use strict';

function updateData(instanceId, databaseId, projectId) {
// [START update_data]
// [START spanner_update_data]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -56,11 +56,11 @@ function updateData(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END update_data]
// [END spanner_update_data]
}

function insertData(instanceId, databaseId, projectId) {
// [START insert_data]
// [START spanner_insert_data]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -115,11 +115,11 @@ function insertData(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END insert_data]
// [END spanner_insert_data]
}

function queryData(instanceId, databaseId, projectId) {
// [START query_data]
// [START spanner_query_data]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -165,11 +165,11 @@ function queryData(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END query_data]
// [END spanner_query_data]
}

function readData(instanceId, databaseId, projectId) {
// [START read_data]
// [START spanner_read_data]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -220,11 +220,11 @@ function readData(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END read_data]
// [END spanner_read_data]
}

function readStaleData(instanceId, databaseId, projectId) {
// [START read_stale_data]
// [START spanner_read_stale_data]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -282,7 +282,7 @@ function readStaleData(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END read_stale_data]
// [END spanner_read_stale_data]
}

require(`yargs`)
Expand Down
20 changes: 10 additions & 10 deletions samples/indexing.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'use strict';

function createIndex(instanceId, databaseId, projectId) {
// [START create_index]
// [START spanner_create_index]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -57,11 +57,11 @@ function createIndex(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END create_index]
// [END spanner_create_index]
}

function createStoringIndex(instanceId, databaseId, projectId) {
// [START create_storing_index]
// [START spanner_create_storing_index]
// "Storing" indexes store copies of the columns they index
// This speeds up queries, but takes more space compared to normal indexes
// See the link below for more information:
Expand Down Expand Up @@ -109,7 +109,7 @@ function createStoringIndex(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END create_storing_index]
// [END spanner_create_storing_index]
}

function queryDataWithIndex(
Expand All @@ -119,7 +119,7 @@ function queryDataWithIndex(
endTitle,
projectId
) {
// [START query_data_with_index]
// [START spanner_query_data_with_index]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -176,11 +176,11 @@ function queryDataWithIndex(
// Close the database when finished.
return database.close();
});
// [END query_data_with_index]
// [END spanner_query_data_with_index]
}

function readDataWithIndex(instanceId, databaseId, projectId) {
// [START read_data_with_index]
// [START spanner_read_data_with_index]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -228,11 +228,11 @@ function readDataWithIndex(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END read_data_with_index]
// [END spanner_read_data_with_index]
}

function readDataWithStoringIndex(instanceId, databaseId, projectId) {
// [START read_data_with_storing_index]
// [START spanner_read_data_with_storing_index]
// "Storing" indexes store copies of the columns they index
// This speeds up queries, but takes more space compared to normal indexes
// See the link below for more information:
Expand Down Expand Up @@ -290,7 +290,7 @@ function readDataWithStoringIndex(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END read_data_with_storing_index]
// [END spanner_read_data_with_storing_index]
}

require(`yargs`)
Expand Down
12 changes: 6 additions & 6 deletions samples/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'use strict';

function createDatabase(instanceId, databaseId, projectId) {
// [START create_database]
// [START spanner_create_database]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -70,11 +70,11 @@ function createDatabase(instanceId, databaseId, projectId) {
.catch(err => {
console.error('ERROR:', err);
});
// [END create_database]
// [END spanner_create_database]
}

function addColumn(instanceId, databaseId, projectId) {
// [START add_column]
// [START spanner_add_column]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -115,11 +115,11 @@ function addColumn(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END add_column]
// [END spanner_add_column]
}

function queryDataWithNewColumn(instanceId, databaseId, projectId) {
// [START query_data_with_new_column]
// [START spanner_query_data_with_new_column]
// This sample uses the `MarketingBudget` column. You can add the column
// by running the `add_column` sample or by running this DDL statement against
// your database:
Expand Down Expand Up @@ -173,7 +173,7 @@ function queryDataWithNewColumn(instanceId, databaseId, projectId) {
// Close the database when finished.
return database.close();
});
// [END query_data_with_new_column]
// [END spanner_query_data_with_new_column]
}

require(`yargs`)
Expand Down
8 changes: 4 additions & 4 deletions samples/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'use strict';

function readOnlyTransaction(instanceId, databaseId, projectId) {
// [START read_only_transaction]
// [START spanner_read_only_transaction]
// Imports the Google Cloud client library
const Spanner = require('@google-cloud/spanner');

Expand Down Expand Up @@ -91,11 +91,11 @@ function readOnlyTransaction(instanceId, databaseId, projectId) {
return database.close();
});
});
// [END read_only_transaction]
// [END spanner_read_only_transaction]
}

function readWriteTransaction(instanceId, databaseId, projectId) {
// [START read_write_transaction]
// [START spanner_read_write_transaction]
// This sample transfers 200,000 from the MarketingBudget field
// of the second Album to the first Album. Make sure to run the
// addColumn and updateData samples first (in that order).
Expand Down Expand Up @@ -203,7 +203,7 @@ function readWriteTransaction(instanceId, databaseId, projectId) {
return database.close();
});
});
// [END read_write_transaction]
// [END spanner_read_write_transaction]
}

require(`yargs`)
Expand Down
14 changes: 7 additions & 7 deletions src/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,11 +939,11 @@ Database.prototype.getTransaction = function(options, callback) {
* });
*
* @example <caption>include:samples/crud.js</caption>
* region_tag:query_data
* region_tag:spanner_query_data
* Full example:
*
* @example <caption>include:samples/indexing.js</caption>
* region_tag:query_data_with_index
* region_tag:spanner_query_data_with_index
* Querying data with an index:
*/
Database.prototype.run = function(query, options, callback) {
Expand Down Expand Up @@ -1226,11 +1226,11 @@ Database.prototype.runStream = function(query, options) {
* });
*
* @example <caption>include:samples/transaction.js</caption>
* region_tag:read_only_transaction
* region_tag:spanner_read_only_transaction
* Read-only transaction:
*
* @example <caption>include:samples/transaction.js</caption>
* region_tag:read_write_transaction
* region_tag:spanner_read_write_transaction
* Read-write transaction:
*/
Database.prototype.runTransaction = function(options, runFn) {
Expand Down Expand Up @@ -1346,15 +1346,15 @@ Database.prototype.table = function(name) {
* });
*
* @example <caption>include:samples/schema.js</caption>
* region_tag:add_column
* region_tag:spanner_add_column
* Adding a column:
*
* @example <caption>include:samples/indexing.js</caption>
* region_tag:create_index
* region_tag:spanner_create_index
* Creating an index:
*
* @example <caption>include:samples/indexing.js</caption>
* region_tag:create_storing_index
* region_tag:spanner_create_storing_index
* Creating a storing index:
*/
Database.prototype.updateSchema = function(statements, callback) {
Expand Down
2 changes: 1 addition & 1 deletion src/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Instance.formatName_ = function(projectId, name) {
* });
*
* @example <caption>include:samples/schema.js</caption>
* region_tag:create_database
* region_tag:spanner_create_database
* Full example:
*/
Instance.prototype.createDatabase = function(name, options, callback) {
Expand Down
12 changes: 6 additions & 6 deletions src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ Table.prototype.deleteRows = function(keys, callback) {
* });
*
* @example <caption>include:samples/crud.js</caption>
* region_tag:insert_data
* region_tag:spanner_insert_data
* Full example:
*/
Table.prototype.insert = function(keyVals, callback) {
Expand Down Expand Up @@ -513,19 +513,19 @@ Table.prototype.insert = function(keyVals, callback) {
* });
*
* @example <caption>include:samples/crud.js</caption>
* region_tag:read_data
* region_tag:spanner_read_data
* Full example:
*
* @example <caption>include:samples/crud.js</caption>
* region_tag:read_stale_data
* region_tag:spanner_read_stale_data
* Reading stale data:
*
* @example <caption>include:samples/indexing.js</caption>
* region_tag:read_data_with_index
* region_tag:spanner_read_data_with_index
* Reading data using an index:
*
* @example <caption>include:samples/indexing.js</caption>
* region_tag:read_data_with_storing_index
* region_tag:spanner_read_data_with_storing_index
* Reading data using a storing index:
*/
Table.prototype.read = function(keyVals, options, callback) {
Expand Down Expand Up @@ -629,7 +629,7 @@ Table.prototype.replace = function(keyVals, callback) {
* });
*
* @example <caption>include:samples/crud.js</caption>
* region_tag:update_data
* region_tag:spanner_update_data
* Full example:
*/
Table.prototype.update = function(keyVals, callback) {
Expand Down

0 comments on commit 04283e8

Please sign in to comment.