如何通过谓词查询方式获取数据
==============

[getEntries()](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-distributedkvstore#getentries-3)可以使用谓词查询，根据谓词查询的方式批量获取value，如使用like，unlike，isnull等方法。

参考代码如下：

import { BusinessError } from '@kit.BasicServicesKit';
import { distributedKVStore } from '@kit.ArkData';

let kvStore: undefined | distributedKVStore.SingleKVStore = undefined;

@Entry
@Component
export struct ReadingTheLocalDatabase {
  build() {
    Row() {
      Column({ space: 20 }) {
        Button('Create database')
          .fontSize(20)
          .fontWeight(FontWeight.Bold)
          .onClick(async () => {
            try {
              let name = new distributedKVStore.FieldNode('name'); _// Create FieldNode_
              name.type = distributedKVStore.ValueType.STRING; _// Set NodeType string_
              name.nullable = false; _// NodeData is not null_
              name.default = 'cake'; _// Default_

              let schema1 = new distributedKVStore.Schema(); _// Create Schema_
              schema1.root.appendChild(name); _// add Child name_
              schema1.indexes = \['$.name'\];
             _ // Create KVManager_
              let kvManager = distributedKVStore.createKVManager({
                bundleName: 'TEST\_CRASH\_APP',
                context: this.getUIContext().getHostContext()
              });
             _// Create database_ 
              await kvManager.getKVStore('storeIds', {
                createIfMissing: true,
                backup: false,
                encrypt: false,
                autoSync: false,
                schema: schema1,
                kvStoreType: distributedKVStore.KVStoreType.SINGLE\_VERSION,
                securityLevel: distributedKVStore.SecurityLevel.S2
              }).then((store: distributedKVStore.SingleKVStore) => {
                kvStore = store;
              }).catch((err: BusinessError) => {
                console.info(\`getKVStore error is: ${err.code}, msg is: ${err.message}\`);
              })
              if (kvStore === undefined) {
                return;
              }
              let entries: distributedKVStore.Entry\[\] = \[\];
              for (let i = 0; i < 10; i++) {
                let ent: distributedKVStore.Entry = {
                  key: 'test' + i,
                  value: {
                    type: distributedKVStore.ValueType.STRING,
                    value: '{"name":"cake"}'
                  }
                }
                entries.push(ent);
              }
             _// insert data_ 
              kvStore.putBatch(entries)
                .then((data) => {
                  console.info('Succeeded in putting Batch');
                })
                .catch((err: BusinessError) => {
                  console.info(\`putBatch error is: ${err.code}, msg is: ${err.message}\`);
                })
            } catch (e) {
              console.info(\`putBatch e is: ${e.code}, msg is: ${e.message}\`);
            }
          })

        Button('like select')
          .fontSize(20)
          .onClick(() => {
            try {
              if (kvStore === undefined) {
                return;
              }
            _  // Use predicates to query a specified field that has a value similar to the specified string, and obtain a list of key value pairs that match the specified Query object_
              kvStore.getEntries(new distributedKVStore.Query().like('$.name', 'c%'))
                .then((value) => {
                  for (let i = 0; i < value.length; i++) {
                    console.info('key:' + value\[i\].key + 'value : ' + JSON.stringify(value\[i\].value))
                  }
                })
                .catch((err: BusinessError) => {
                  console.info(\`getEntries error is: ${err.code}, msg is: ${err.message}\`);
                })
            } catch (e) {
              console.info(\`getEntries e is: ${e.code}, msg is: ${e.message}\`);
            }
          })
      }
      .width('100%')
    }
    .height('100%')
  }
}