• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DATASHARE_PREDICATES_PROXY_H
17 #define DATASHARE_PREDICATES_PROXY_H
18 
19 #include <memory>
20 #include "datashare_abs_predicates.h"
21 #include "napi/native_api.h"
22 #include "napi/native_common.h"
23 #include "napi/native_node_api.h"
24 
25 namespace OHOS {
26 namespace DataShare {
27 class DataSharePredicatesProxy : private DataShareAbsPredicates::JsProxy {
28 public:
29     static void Init(napi_env env, napi_value exports);
30     static napi_value NewInstance(napi_env env, std::shared_ptr<DataShareAbsPredicates> value);
31     static std::shared_ptr<DataShareAbsPredicates> GetNativePredicates(
32         const napi_env &env, const napi_value &arg);
33     static void Destructor(napi_env env, void *nativeObject, void *finalize_hint);
34 
35     DataSharePredicatesProxy();
36     static napi_value GetConstructor(napi_env env);
37 
38 private:
39     ~DataSharePredicatesProxy();
40 
41     static napi_value New(napi_env env, napi_callback_info info);
42     static std::shared_ptr<DataShareAbsPredicates> GetNativePredicates(napi_env env, napi_callback_info info);
43 
44     static napi_value EqualTo(napi_env env, napi_callback_info info);
45     static napi_value NotEqualTo(napi_env env, napi_callback_info info);
46     static napi_value BeginWrap(napi_env env, napi_callback_info info);
47     static napi_value EndWrap(napi_env env, napi_callback_info info);
48     static napi_value Or(napi_env env, napi_callback_info info);
49     static napi_value And(napi_env env, napi_callback_info info);
50     static napi_value Contains(napi_env env, napi_callback_info info);
51     static napi_value BeginsWith(napi_env env, napi_callback_info info);
52     static napi_value EndsWith(napi_env env, napi_callback_info info);
53     static napi_value IsNull(napi_env env, napi_callback_info info);
54     static napi_value IsNotNull(napi_env env, napi_callback_info info);
55     static napi_value Like(napi_env env, napi_callback_info info);
56     static napi_value Unlike(napi_env env, napi_callback_info info);
57     static napi_value Glob(napi_env env, napi_callback_info info);
58     static napi_value Between(napi_env env, napi_callback_info info);
59     static napi_value NotBetween(napi_env env, napi_callback_info info);
60     static napi_value GreaterThan(napi_env env, napi_callback_info info);
61     static napi_value LessThan(napi_env env, napi_callback_info info);
62     static napi_value GreaterThanOrEqualTo(napi_env env, napi_callback_info info);
63     static napi_value LessThanOrEqualTo(napi_env env, napi_callback_info info);
64     static napi_value OrderByAsc(napi_env env, napi_callback_info info);
65     static napi_value OrderByDesc(napi_env env, napi_callback_info info);
66     static napi_value Distinct(napi_env env, napi_callback_info info);
67     static napi_value Limit(napi_env env, napi_callback_info info);
68     static napi_value GroupBy(napi_env env, napi_callback_info info);
69     static napi_value IndexedBy(napi_env env, napi_callback_info info);
70     static napi_value In(napi_env env, napi_callback_info info);
71     static napi_value NotIn(napi_env env, napi_callback_info info);
72     static napi_value PrefixKey(napi_env env, napi_callback_info info);
73     static napi_value InKeys(napi_env env, napi_callback_info info);
74 };
75 } // namespace DataShare
76 } // namespace OHOS
77 #endif // DATASHARE_PREDICATES_PROXY_H
78