How to use the @google-cloud/spanner.Spanner.float function in @google-cloud/spanner

To help you get started, we’ve selected a few @google-cloud/spanner examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleCloudPlatform / training-data-analyst / courses / developingapps / v1.2 / nodejs / pubsub-languageapi-spanner / end / server / gcp / spanner.js View on Github external
.replace(/[@\.]/g, '_')
        .split('_')
        .reverse()
        .join('_');
    
    // END TODO

    // TODO: Create record object to be inserted into Spanner
    // USe Spanner.float() to convert the score property
    const record = {
        feedbackId: `${rev_email}_${quiz}_${timestamp}`,
        email,
        quiz,
        timestamp,
        rating,
        score: Spanner.float(score),
        feedback,
    };
    // END TODO

    // TODO: Insert the record into the table using await
    // use try {} catch {} and check for err.code==6 to trap
    // insert errors caused by duplicated PubSub messages
    try {
        console.log('Saving feedback');
        await feedbackTable.insert(record);
    } catch (err) {
        if (err.code === 6 ) {
            console.log("Duplicate message - feedback already saved");
        } else {
            console.error('ERROR processing feedback:', err);
        }

@google-cloud/spanner

Cloud Spanner Client Library for Node.js

Apache-2.0
Latest version published 8 days ago

Package Health Score

86 / 100
Full package analysis