Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bogus .value after calling toJSON() #314

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spanner/crud.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function queryData (instanceId, databaseId) {

rows.forEach((row) => {
const json = row.toJSON();
console.log(`SingerId: ${json.SingerId.value}, AlbumId: ${json.AlbumId.value}, AlbumTitle: ${json.AlbumTitle}`);
console.log(`SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}`);
});
});
// [END query_data]
Expand Down Expand Up @@ -158,7 +158,7 @@ function readData (instanceId, databaseId) {

rows.forEach((row) => {
const json = row.toJSON();
console.log(`SingerId: ${json.SingerId.value}, AlbumId: ${json.AlbumId.value}, AlbumTitle: ${json.AlbumTitle}`);
console.log(`SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}`);
});
});
// [END read_data]
Expand Down
6 changes: 3 additions & 3 deletions spanner/indexing.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function queryDataWithIndex (instanceId, databaseId) {

rows.forEach((row) => {
const json = row.toJSON();
console.log(`AlbumId: ${json.AlbumId.value}, AlbumTitle: ${json.AlbumTitle}, MarketingBudget: ${json.MarketingBudget.value}`);
console.log(`AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}, MarketingBudget: ${json.MarketingBudget}`);
});
});
// [END query_data_with_index]
Expand Down Expand Up @@ -156,7 +156,7 @@ function readDataWithIndex (instanceId, databaseId) {

rows.forEach((row) => {
const json = row.toJSON();
console.log(`AlbumId: ${json.AlbumId.value}, AlbumTitle: ${json.AlbumTitle}`);
console.log(`AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}`);
});
});
// [END read_data_with_index]
Expand Down Expand Up @@ -200,7 +200,7 @@ function readDataWithStoringIndex (instanceId, databaseId) {

rows.forEach((row) => {
const json = row.toJSON();
console.log(`AlbumId: ${json.AlbumId.value}, AlbumTitle: ${json.AlbumTitle}, MarketingBudget: ${json.MarketingBudget.value}`);
console.log(`AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}, MarketingBudget: ${json.MarketingBudget}`);
});
});
// [END read_data_with_storing_index]
Expand Down
2 changes: 1 addition & 1 deletion spanner/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function queryDataWithNewColumn (instanceId, databaseId) {
rows.forEach((row) => {
const json = row.toJSON();

console.log(`SingerId: ${json.SingerId.value}, AlbumId: ${json.AlbumId.value}, MarketingBudget: ${json.MarketingBudget ? json.MarketingBudget.value : null}`);
console.log(`SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, MarketingBudget: ${json.MarketingBudget ? json.MarketingBudget.value : null}`);
});
});
// [END query_data_with_new_column]
Expand Down
8 changes: 4 additions & 4 deletions spanner/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function readOnlyTransaction (instanceId, databaseId) {

rows.forEach((row) => {
const json = row.toJSON();
console.log(`SingerId: ${json.SingerId.value}, AlbumId: ${json.AlbumId.value}, AlbumTitle: ${json.AlbumTitle}`);
console.log(`SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}`);
});
});

Expand All @@ -66,7 +66,7 @@ function readOnlyTransaction (instanceId, databaseId) {

rows.forEach((row) => {
const json = row.toJSON();
console.log(`SingerId: ${json.SingerId.value}, AlbumId: ${json.AlbumId.value}, AlbumTitle: ${json.AlbumTitle}`);
console.log(`SingerId: ${json.SingerId}, AlbumId: ${json.AlbumId}, AlbumTitle: ${json.AlbumTitle}`);
});
});
})
Expand Down Expand Up @@ -122,7 +122,7 @@ function readWriteTransaction (instanceId, databaseId) {
// Note: MarketingBudget is an INT64, which comes from Cloud Spanner
// as a string - so we convert it to a number with parseInt()
const rows = results[0].map((row) => row.toJSON());
secondBudget = parseInt(rows[0].MarketingBudget.value);
secondBudget = parseInt(rows[0].MarketingBudget);
console.log(`The second album's marketing budget: ${secondBudget}`);

// Makes sure the second album's budget is sufficient
Expand All @@ -136,7 +136,7 @@ function readWriteTransaction (instanceId, databaseId) {
// Gets first album's budget
// As above, MarketingBudget is an INT64 and comes as a string
const rows = results[0].map((row) => row.toJSON());
firstBudget = parseInt(rows[0].MarketingBudget.value);
firstBudget = parseInt(rows[0].MarketingBudget);
console.log(`The first album's marketing budget: ${firstBudget}`);
})
]);
Expand Down