1.0.0 • Published 4 years ago

clouddb-test v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

CloudDB SDK for Cloud Functions

The clouddb package can be used to define Cloud Functions for CloudDB. Cloud Function is a hosted, private, and scalabel Node.js environment where you can run JavaScript code. The CloudDB SDK for Cloud Function provides a tool to let you write code that responds to events from CloudDB services.

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

Installation is done using the npm install command:

$ npm install clouddb

Learn more

Learn more about the CloudDB SDK for Cloud Functions in the CloudDB documentation or check out our samples.

Here are some resources to get help:

Usage

const naturalBaseAPI = require("clouddb");
var dataName = "db0"; // your database name
var tableName = "students2"; //your table name
var queryCondition = [{conditionType: "Limit", value: {number: 10, offset: 0}}];
var cloudDBZone = new naturalBaseAPI.CloudDBZone(dataName,contextA);
cloudDBZone.executeQuery(tableName, queryCondition, function (result, data) {
        if (!result) {
            context.logger.info(data);
        } else {
            context.logger.info(data);
        }
});
//handler.js is a demo for Cloud function.
let myHandler = function(event, context) {
    const naturalBaseAPI = require("couddb");
    var dataName = "db0"; // your database name
    var tableName = "students2"; //your table name
    var queryCondition = [{conditionType: "Limit", value: {number: 10, offset: 0}}];
    // query
    cloudDBZone.executeQuery(tableName, queryCondition, function (result, data) {
        context.logger.info(result);
        context.callback(data);
    });
};

module.exports.myHandler = myHandler;

License

© Huawei, 2019. Licensed under The MIT License.

1.0.0

4 years ago