A modern C++20 type-safe, thread-safe SQLite query builder with fluent API and compile-time validation.
- 🔒 Thread-safe schema caching with
std::shared_mutex - 🛡️ Type-safe queries with compile-time column validation
- 🎯 Fluent API for readable, chainable query construction
- ⚡ Zero runtime overhead with modern C++20 features
- 📦 Easy integration via vcpkg, CMake FetchContent
- 🔍 Schema introspection and automatic caching
- 🧪 Production-ready with comprehensive error handling
#include <sqlite_flux/QueryBuilder.h>
#include <sqlite_flux/Analyzer.h>
sqlite_flux::Analyzer db("database.db");
db.cacheAllSchemas(); // Thread-safe schema caching
sqlite_flux::QueryFactory factory(db);
auto results = factory.FromTable("users")
.Columns("id", "username", "email")
.Filter("is_active", int64_t(1))
.Filter("age", int64_t(18), sqlite_flux::CompareOp::GreaterThanOrEqual)
.OrderBy("username")
.Limit(10)
.Execute();vcpkg install sqlite-fluxinclude(FetchContent)
FetchContent_Declare(
sqlite_flux
GIT_REPOSITORY https://github.com/a-alomran/sqlite-flux.git
GIT_TAG v1.0.0
)
FetchContent_MakeAvailable(sqlite_flux)
target_link_libraries(your_target PRIVATE sqlite_flux::sqlite_flux)Requirements:
- C++20 compatible compiler (MSVC 2022, GCC 11+, Clang 13+)
- CMake 3.15+
- SQLite3
Build:
git clone https://github.com/YourUsername/sqlite-flux.git
cd sqlite-flux
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config ReleaseSee docs/API.md for complete API reference.
- ✅
Analyzerclass: Thread-safe for concurrent reads - ✅ Schema cache: Uses
std::shared_mutexfor concurrent access ⚠️ QueryBuilder: Not thread-safe (create per-thread instances)
See docs/THREAD_SAFETY.md for details.
MIT License - see LICENSE file.
Contributions welcome! See CONTRIBUTING.md.