diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/BUILD.gn b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bf1a5b8fc72d85936a2f667b614f582a6b071e55 --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/BUILD.gn @@ -0,0 +1,14 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ \ No newline at end of file diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/CMakeLists.txt b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1c459e3c802a1516aca9994ff8a2be932f276e64 --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) + +project(grd_simple VERSION 1.0.0) \ No newline at end of file diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/README.md b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1d777fec2bfb8f35529ccd0cc52f38b3a4790cb8 --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/README.md @@ -0,0 +1 @@ +# Document DB diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_db_api.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_db_api.h new file mode 100644 index 0000000000000000000000000000000000000000..e607b0f5b1bfda71d69f1a972b168768bba08a2d --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_db_api.h @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef GRD_DB_API_H +#define GRD_DB_API_H + +#include "grd_type_export.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +int GRD_DBOpen(const char *dbPath, const char *configStr, unsigned int flags, GRD_DB **db); + +int GRD_DBClose(GRD_DB *db, unsigned int flags); + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // GRD_DB_API_H \ No newline at end of file diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_error.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_error.h new file mode 100644 index 0000000000000000000000000000000000000000..0abe8e9637aa79a04aafd9ccdad56e34a86c957f --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_error.h @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef GRD_ERROR_H +#define GRD_ERROR_H + +#include "grd_type_export.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#define GRD_OK 0 + +#define GRD_NOT_SUPPORT (-1000) +#define GRD_OVER_LIMIT (-2000) +#define GRD_INVALID_ARGS (-3000) +#define GRD_SYSTEM_ERR (-4000) +#define GRD_NO_DATA (-11000) +#define GRD_FAILED_MEMORY_ALLOCATE (-13000) +#define GRD_FAILED_MEMORY_RELEASE (-14000) +#define GRD_INVALID_FORMAT (-37000) + +#define GRD_FIELD_NOT_FOUND (-5003002) +#define GRD_FIELD_TYPE_NOT_MATCH (-5003003) +#define GRD_LARGE_JSON_NEST (-5003004) + +#define GRD_UNVAILABLE_JSON_LIB (-5004001) + + +#define GRD_COLLECTION_NOT_FOUND (-5011001) +#define GRD_RECORD_NOT_FOUND (-5011002) + +#define GRD_INVALID_JSON_FORMAT (-5037001) + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // GRD_ERROR_H \ No newline at end of file diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_resultset_api.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_resultset_api.h new file mode 100644 index 0000000000000000000000000000000000000000..27a64277602d6f60dca5299cd4f19c2fa01c1672 --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_resultset_api.h @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef GRD_RESULTSET_API_H +#define GRD_RESULTSET_API_H + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +typedef struct GRD_ResultSet GRD_ResultSet; + +int GRD_Next(GRD_ResultSet *resultSet); + +int GRD_GetValue(GRD_ResultSet *resultSet, char **value); + +int GRD_FreeValue(char *value); + +int GRD_FreeResultSet(GRD_ResultSet *resultSet); + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // GRD_RESULTSET_API_H \ No newline at end of file diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_type_export.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_type_export.h new file mode 100644 index 0000000000000000000000000000000000000000..602b058595b3f867afa16081476f1c890500c3e7 --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_type_export.h @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef GRD_TYPE_EXPORT_H +#define GRD_TYPE_EXPORT_H + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +typedef struct GRD_DB GRD_DB; + +typedef struct Query { + const char *filter; + const char *projection; +} Query; + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // GRD_TYPE_EXPORT_H \ No newline at end of file diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_document/grd_document_api.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_document/grd_document_api.h new file mode 100644 index 0000000000000000000000000000000000000000..09f1719c9dc5b7123b1c56c9c43f3e1492793644 --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_document/grd_document_api.h @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef GRD_DOCUMENT_API_H +#define GRD_DOCUMENT_API_H + +#include "grd_type_export.h" +#include "grd_resultset_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int GRD_CreateCollection(GRD_DB *db, const char *collectionName, const char *optionStr, unsigned int flags); + +int GRD_DropCollection(GRD_DB *db, const char *collectionName, unsigned int flags); + +int GRD_InsertDoc(GRD_DB *db, const char *collectionName, const char *document, unsigned int flags); + +int GRD_FindDoc(GRD_DB *db, const char *collectionName, Query query, unsigned int flags, GRD_ResultSet **resultSet); + +int GRD_UpdateDoc(GRD_DB *db, const char *collectionName, const char *filter, const char *update, unsigned int flags); + +int GRD_UpSertDoc(GRD_DB *db, const char *collectionName, const char *filter, const char *document, unsigned int flags); + +int GRD_DeleteDoc(GRD_DB *db, const char *collectionName, const char *filter, unsigned int flags); + +#ifdef __cplusplus +} +#endif +#endif // GRD_DOCUMENT_API_H \ No newline at end of file diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/common/include/doc_error.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/common/include/doc_error.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/excutor/base/grd_db_api.c b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/excutor/base/grd_db_api.c new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/excutor/document/grd_document_api.c b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/excutor/document/grd_document_api.c new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/include/document_store_delegate.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/include/document_store_delegate.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/oh_adapter/json_operator.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/src/oh_adapter/json_operator.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/test/unittest/BUILD.gn b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/test/unittest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bf1a5b8fc72d85936a2f667b614f582a6b071e55 --- /dev/null +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/test/unittest/BUILD.gn @@ -0,0 +1,14 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ \ No newline at end of file