Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC: Add MQL translation skeleton #7123

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/realm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ set(UTIL_SOURCES
util/random.cpp
util/resource_limits.cpp
util/uri.cpp
util/bson/bson.cpp
util/bson/regular_expression.cpp
)

set(REALM_INSTALL_HEADERS
Expand Down Expand Up @@ -272,6 +274,12 @@ set(REALM_NOINST_HEADERS
util/timestamp_formatter.hpp
util/timestamp_logger.hpp
util/value_reset_guard.hpp
util/bson/bson.hpp
util/bson/min_key.hpp
util/bson/max_key.hpp
util/bson/regular_expression.hpp
util/bson/indexed_map.hpp
util/bson/mongo_timestamp.hpp
) # REALM_NOINST_HEADERS

if(NOT MSVC)
Expand Down
13 changes: 2 additions & 11 deletions src/realm/object-store/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,7 @@ if(REALM_ENABLE_SYNC)
sync/impl/sync_client.hpp
sync/impl/sync_file.hpp
sync/impl/sync_metadata.hpp
sync/impl/network_reachability.hpp

util/bson/bson.hpp
util/bson/min_key.hpp
util/bson/max_key.hpp
util/bson/regular_expression.hpp
util/bson/indexed_map.hpp
util/bson/mongo_timestamp.hpp)
sync/impl/network_reachability.hpp)

list(APPEND SOURCES
sync/app.cpp
Expand All @@ -133,9 +126,7 @@ if(REALM_ENABLE_SYNC)
sync/mongo_database.cpp
sync/push_client.cpp
sync/impl/sync_file.cpp
sync/impl/sync_metadata.cpp
util/bson/bson.cpp
util/bson/regular_expression.cpp)
sync/impl/sync_metadata.cpp)
if(APPLE)
list(APPEND HEADERS
sync/impl/apple/network_reachability_observer.hpp
Expand Down
12 changes: 11 additions & 1 deletion src/realm/object-store/results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <realm/object-store/schema.hpp>
#include <realm/object-store/class.hpp>
#include <realm/object-store/sectioned_results.hpp>

#include <realm/util/bson/bson.hpp>
#include <realm/set.hpp>

#include <stdexcept>
Expand Down Expand Up @@ -56,6 +56,16 @@ Results::Results(SharedRealm r, Query q, DescriptorOrdering o)
{
}

Results::Results(SharedRealm r, ConstTableRef table, const bson::BsonDocument& document)
: Results(r, table->query(document))
{
}

Results::Results(SharedRealm r, ConstTableRef table, const std::string& document)
: Results(r, table->query(static_cast<bson::BsonDocument>(bson::parse(document))))
{
}

Results::Results(const Class& cls)
: Results(cls.get_realm(), cls.get_table())
{
Expand Down
5 changes: 5 additions & 0 deletions src/realm/object-store/results.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Results {
Results();
Results(const Class&);
Results(std::shared_ptr<Realm> r, ConstTableRef table);
Results(std::shared_ptr<Realm> r, ConstTableRef, const bson::BsonDocument& document);
Results(std::shared_ptr<Realm> r, ConstTableRef, const std::string& document);
Results(std::shared_ptr<Realm> r, Query q, DescriptorOrdering o = {});
Results(std::shared_ptr<Realm> r, TableView tv, DescriptorOrdering o = {});
Results(std::shared_ptr<Realm> r, const Obj& obj, TableKey src_table, ColKey src_col_key)
Expand Down Expand Up @@ -152,6 +154,9 @@ class Results {

// Create a new Results by further filtering or sorting this Results
Results filter(Query&& q) const REQUIRES(!m_mutex);
Results find(const bson::BsonDocument& document) const REQUIRES(!m_mutex);
Results find(const std::string& document) const REQUIRES(!m_mutex);

// Create a new Results by sorting this Result.
Results sort(SortDescriptor&& sort) const REQUIRES(!m_mutex);
// Create a new Results by sorting this Result based on the specified key paths.
Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/sync/app_credentials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////

#include <realm/object-store/sync/app_credentials.hpp>
#include <realm/object-store/util/bson/bson.hpp>
#include <realm/util/bson/bson.hpp>

namespace realm::app {

Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/sync/app_service_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef APP_SERVICE_CLIENT_HPP
#define APP_SERVICE_CLIENT_HPP

#include <realm/object-store/util/bson/bson.hpp>
#include <realm/util/bson/bson.hpp>
#include <realm/util/functional.hpp>
#include <realm/util/optional.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/sync/mongo_collection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef MONGO_COLLECTION_HPP
#define MONGO_COLLECTION_HPP

#include <realm/object-store/util/bson/bson.hpp>
#include <realm/util/bson/bson.hpp>
#include <realm/util/functional.hpp>
#include <realm/util/optional.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/sync/push_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <realm/object-store/sync/app_utils.hpp>
#include <realm/object-store/sync/auth_request_client.hpp>
#include <realm/object-store/sync/generic_network_transport.hpp>
#include <realm/object-store/util/bson/bson.hpp>
#include <realm/util/bson/bson.hpp>

namespace realm::app {

Expand Down
2 changes: 1 addition & 1 deletion src/realm/object-store/sync/sync_user.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define REALM_OS_SYNC_USER_HPP

#include <realm/object-store/util/atomic_shared_ptr.hpp>
#include <realm/object-store/util/bson/bson.hpp>
#include <realm/util/bson/bson.hpp>
#include <realm/object-store/sync/subscribable.hpp>

#include <realm/util/checked_mutex.hpp>
Expand Down
5 changes: 3 additions & 2 deletions src/realm/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ if(NOT REALM_CORE_SUBMODULE_BUILD)
endif()

set(REALM_PARSER_SOURCES
driver.cpp
query_ast.cpp
query_bson.cpp
keypath_mapping.cpp
) # REALM_PARSER_SOURCES

Expand All @@ -41,7 +42,7 @@ set(REALM_PARSER_GENERATED
) # REALM_PARSER_SOURCES

set(REALM_PARSER_HEADERS
driver.hpp
query_ast.hpp
keypath_mapping.hpp
query_parser.hpp
generated/query_bison.hpp
Expand Down
Loading
Loading