test-nb-hou
v1.0.0
Published
clouddb-test is a tool to access clouddb service.
Downloads
12
Readme
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:
- Start with the quickstart: https://www.huawei.com/
- Go through the guide: https://www.huawei.com/
- Read the full API reference: https://www.huawei.com/
- Browse some examples: https://www.huawei.com/
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
© 2019. Licensed under The MIT License.