@google-cloud/spanner
Advanced tools
Changelog
v2.2.0
11-27-2018 09:13 PST
Changelog
v2.1.0
Changelog
v2.0.0
Drop support for Node.js v4.x.x and v9.x.x (#226)
Use es style imports (#302) The import syntax for this library has changed to be es module compliant.
const spanner = require('@google-cloud/spanner')();
// or
const Spanner = require('@google-cloud/spanner');
const spanner = new Spanner();
const {Spanner} = require('@google-cloud/spanner');
const spanner = new Spanner();
const {Spanner} = require('@google-cloud/spanner');
const spanner = new Spanner();
const instance = spanner.instance('my-instance');
const database = instance.database('my-database');
await database.runTransactionAsync(async (transaction) => {
const [rows] = await transaction.run('SELECT * FROM MyTable');
const data = rows.map(row => row.thing);
await transaction.commit();
return data;
}).then(data => {
// ...
});