A Swift query builder for Vapor 3 that simplifies complex raw SQL queries using KeyPaths.
FluentQuery is a Swift library for Vapor 3 that enables developers to construct complex raw SQL queries in a type-safe, Swift-native way using KeyPaths. It addresses the maintenance challenges of raw SQL by leveraging Swift's compiler and refactoring tools, making database interactions more robust and developer-friendly.
Swift developers building Vapor 3 applications who need to write complex, performant raw SQL queries while maintaining type safety and ease of refactoring.
Developers choose FluentQuery because it combines the flexibility and power of raw SQL with the safety and maintainability of Swift, allowing them to leverage full database capabilities without sacrificing code quality. It provides compile-time safety through KeyPaths, supports complex query building with joins and subqueries, and integrates seamlessly with PostgreSQL.
🗃 Powerful and easy to use Swift Query Builder for Vapor 3.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses Swift KeyPaths to ensure compile-time safety and easy refactoring, eliminating common errors in raw SQL strings and allowing Xcode refactoring tools to work seamlessly.
Supports advanced SQL features like joins, subqueries, window functions, and conditional logic with Swift if/else, enabling intricate queries such as the multi-join car example in the README.
Integrates deeply with PostgreSQL, offering support for JSON/JSONB operations and advanced functions like build_jsonb_object, which is highlighted in the methods section.
Decodes raw database results directly into Swift Codable models, as shown in examples where PublicUser or PublicCar are decoded without manual mapping.
The library is explicitly marked as deprecated, with the author recommending SwifQL, meaning no future updates, bug fixes, or security patches, which risks project stability.
Only compatible with Vapor 3 and PostgreSQL, limiting adoption in projects using newer Vapor versions or other databases like MySQL or SQLite, as admitted in the dependencies.
Requires understanding of both raw SQL and Swift KeyPaths, with a verbose API for building queries, as evidenced by the lengthy method lists and alias management in the README.
Relies on Fluent's Model.reflectProperty method for KeyPath decoding, tying it to Fluent's ecosystem and potential breaking changes, which isn't ideal for standalone use.