未验证 提交 dc5b4ef7 编写于 作者: 葛亚芳 提交者: Gitee

update en/application-dev/reference/apis/js-apis-distributed-data.md.

Signed-off-by: Nge-yafang <geyafang@huawei.com>
上级 df4239d9
...@@ -2341,10 +2341,10 @@ try { ...@@ -2341,10 +2341,10 @@ try {
console.log('entries: ' + JSON.stringify(entries)); console.log('entries: ' + JSON.stringify(entries));
kvStore.putBatch(entries, async function (err,data) { kvStore.putBatch(entries, async function (err,data) {
console.log('putBatch success'); console.log('putBatch success');
kvStore.getEntries('batch_test_string_key', function (err,entrys) { kvStore.getEntries('batch_test_string_key', function (err,entries) {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
}); });
}); });
}catch(e) { }catch(e) {
...@@ -2393,7 +2393,7 @@ try { ...@@ -2393,7 +2393,7 @@ try {
console.log('entries: ' + JSON.stringify(entries)); console.log('entries: ' + JSON.stringify(entries));
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('putBatch success'); console.log('putBatch success');
kvStore.getEntries('batch_test_string_key').then((entrys) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('getEntries success'); console.log('getEntries success');
console.log('PutBatch ' + JSON.stringify(entries)); console.log('PutBatch ' + JSON.stringify(entries));
}).catch((err) => { }).catch((err) => {
...@@ -3049,10 +3049,10 @@ try { ...@@ -3049,10 +3049,10 @@ try {
} }
kvStore.putBatch(entries, async function (err,data) { kvStore.putBatch(entries, async function (err,data) {
console.log('putBatch success'); console.log('putBatch success');
kvStore.getEntries('batch_test_number_key', function (err,entrys) { kvStore.getEntries('batch_test_number_key', function (err,entries) {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
}); });
}); });
}catch(e) { }catch(e) {
...@@ -3101,12 +3101,12 @@ try { ...@@ -3101,12 +3101,12 @@ try {
console.log('entries: ' + entries); console.log('entries: ' + entries);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('putBatch success'); console.log('putBatch success');
kvStore.getEntries('batch_test_string_key').then((entrys) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
console.log('entrys[0].value: ' + JSON.stringify(entrys[0].value)); console.log('entries[0].value: ' + JSON.stringify(entries[0].value));
console.log('entrys[0].value.value: ' + entrys[0].value.value); console.log('entries[0].value.value: ' + entries[0].value.value);
}).catch((err) => { }).catch((err) => {
console.log('getEntries fail ' + JSON.stringify(err)); console.log('getEntries fail ' + JSON.stringify(err));
}); });
...@@ -3157,10 +3157,10 @@ try { ...@@ -3157,10 +3157,10 @@ try {
console.log('putBatch success'); console.log('putBatch success');
const query = new distributedData.Query(); const query = new distributedData.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query, function (err,entrys) { kvStore.getEntries(query, function (err,entries) {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
}); });
}); });
console.log('GetEntries success'); console.log('GetEntries success');
...@@ -3213,7 +3213,7 @@ try { ...@@ -3213,7 +3213,7 @@ try {
console.log('putBatch success'); console.log('putBatch success');
const query = new distributedData.Query(); const query = new distributedData.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query).then((entrys) => { kvStore.getEntries(query).then((entries) => {
console.log('getEntries success'); console.log('getEntries success');
}).catch((err) => { }).catch((err) => {
console.log('getEntries fail ' + JSON.stringify(err)); console.log('getEntries fail ' + JSON.stringify(err));
...@@ -4047,10 +4047,10 @@ try { ...@@ -4047,10 +4047,10 @@ try {
console.log('entries: ' + entries); console.log('entries: ' + entries);
kvStore.putBatch(entries, async function (err,data) { kvStore.putBatch(entries, async function (err,data) {
console.log('putBatch success'); console.log('putBatch success');
kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err,entrys) { kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err,entries) {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
}); });
}); });
}catch(e) { }catch(e) {
...@@ -4100,12 +4100,12 @@ try { ...@@ -4100,12 +4100,12 @@ try {
console.log('entries: ' + entries); console.log('entries: ' + entries);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('putBatch success'); console.log('putBatch success');
kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entrys) => { kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
console.log('entrys[0].value: ' + JSON.stringify(entrys[0].value)); console.log('entries[0].value: ' + JSON.stringify(entries[0].value));
console.log('entrys[0].value.value: ' + entrys[0].value.value); console.log('entries[0].value.value: ' + entries[0].value.value);
}).catch((err) => { }).catch((err) => {
console.log('getEntries fail ' + JSON.stringify(err)); console.log('getEntries fail ' + JSON.stringify(err));
}); });
...@@ -4157,10 +4157,10 @@ try { ...@@ -4157,10 +4157,10 @@ try {
const query = new distributedData.Query(); const query = new distributedData.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
kvStore.getEntries(query, function (err,entrys) { kvStore.getEntries(query, function (err,entries) {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
}); });
}); });
console.log('GetEntries success'); console.log('GetEntries success');
...@@ -4213,7 +4213,7 @@ try { ...@@ -4213,7 +4213,7 @@ try {
console.log('putBatch success'); console.log('putBatch success');
const query = new distributedData.Query(); const query = new distributedData.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query).then((entrys) => { kvStore.getEntries(query).then((entries) => {
console.log('getEntries success'); console.log('getEntries success');
}).catch((err) => { }).catch((err) => {
console.log('getEntries fail ' + JSON.stringify(err)); console.log('getEntries fail ' + JSON.stringify(err));
...@@ -4268,10 +4268,10 @@ try { ...@@ -4268,10 +4268,10 @@ try {
var query = new distributedData.Query(); var query = new distributedData.Query();
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries('localDeviceId', query, function (err,entrys) { kvStore.getEntries('localDeviceId', query, function (err,entries) {
console.log('getEntries success'); console.log('getEntries success');
console.log('entrys.length: ' + entrys.length); console.log('entries.length: ' + entries.length);
console.log('entrys[0]: ' + JSON.stringify(entrys[0])); console.log('entries[0]: ' + JSON.stringify(entries[0]));
}) })
}); });
console.log('GetEntries success'); console.log('GetEntries success');
...@@ -4326,7 +4326,7 @@ try { ...@@ -4326,7 +4326,7 @@ try {
var query = new distributedData.Query(); var query = new distributedData.Query();
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries('localDeviceId', query).then((entrys) => { kvStore.getEntries('localDeviceId', query).then((entries) => {
console.log('getEntries success'); console.log('getEntries success');
}).catch((err) => { }).catch((err) => {
console.log('getEntries fail ' + JSON.stringify(err)); console.log('getEntries fail ' + JSON.stringify(err));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册