mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-06-28 08:49:38 -04:00
346e2b2514
# Description of Changes - Added a query builder for C++ module bindings - Added query-builder table/filter/join types - Added semijoin support with compile-time checks for lookup-table and indexed-field usage - Added support for returning query-builder queries from C++ views - Hooked query-builder metadata into the C++ table/view macros and V10 module-def path - Added test coverage for the new C++ query-builder behavior - Compile tests for pass/fail cases - SQL tests for generated query output - Added a C++ test module for view primary key coverage - **Update:** Switched the core to pass the columns and index-columns metadata with the table source for better client-side codegen to have some shared code between server + client. # API and ABI breaking changes - No intended API or ABI breaking changes - Adds a new public query-builder API to the C++ bindings - C++ views can now return query-builder query types in addition to materialized row results # Expected complexity level and risk 3 - Mostly contained to C++ bindings, but it touches macros, view registration/serialization, and module-def generation, so there are a few places where the pieces need to stay in sync. # Testing I've done end to end testing of I think every type as well as built some tests to confirm the SQL output. - [x] Run the C++ query-builder SQL tests [crates/bindings-cpp/tests/query-builder-compile/run_query_builder_compile_tests.sh] - [x] Smoke test a generated C++ module using query-builder views --------- Signed-off-by: Jason Larabie <jason@clockworklabs.io> Co-authored-by: Ryan <r.ekhoff@clockworklabs.io> Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
BUILD_DIR="${SCRIPT_DIR}/build"
|
|
CMAKE_EXE="${CMAKE_EXE:-}"
|
|
|
|
if [[ -z "${CMAKE_EXE}" ]]; then
|
|
if command -v cmake >/dev/null 2>&1; then
|
|
CMAKE_EXE="cmake"
|
|
else
|
|
for candidate in \
|
|
"/c/Program Files/CMake/bin/cmake.exe" \
|
|
"/c/Strawberry/c/bin/cmake.exe"
|
|
do
|
|
if [[ -x "${candidate}" ]]; then
|
|
CMAKE_EXE="${candidate}"
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
fi
|
|
|
|
if [[ -z "${CMAKE_EXE}" ]]; then
|
|
echo "Could not find cmake. Set CMAKE_EXE to its full path." >&2
|
|
exit 1
|
|
fi
|
|
|
|
"${CMAKE_EXE}" -S "${SCRIPT_DIR}" -B "${BUILD_DIR}"
|
|
"${CMAKE_EXE}" --build "${BUILD_DIR}" --target query_builder_sql_tests
|
|
|
|
if [[ -x "${BUILD_DIR}/Debug/query_builder_sql_tests.exe" ]]; then
|
|
"${BUILD_DIR}/Debug/query_builder_sql_tests.exe"
|
|
elif [[ -x "${BUILD_DIR}/Release/query_builder_sql_tests.exe" ]]; then
|
|
"${BUILD_DIR}/Release/query_builder_sql_tests.exe"
|
|
elif [[ -x "${BUILD_DIR}/query_builder_sql_tests" ]]; then
|
|
"${BUILD_DIR}/query_builder_sql_tests"
|
|
else
|
|
echo "Could not find query_builder_sql_tests binary in ${BUILD_DIR}" >&2
|
|
exit 1
|
|
fi
|