A non-thread-safe, performance-optimized fluent SQL query builder for Go, forked from Squirrel.
Sqrl is a fluent SQL query builder for Go that allows developers to construct SQL queries programmatically using a chainable, readable API. It solves the problem of writing raw SQL strings manually by providing a composable builder that supports complex queries, conditional logic, and database-specific syntax while optimizing for performance by forgoing thread safety.
Go developers building database-driven applications who need a lightweight, performant way to generate SQL queries without the overhead of an ORM or thread-safe builders.
Developers choose Sqrl for its balance of Squirrel's familiar fluent interface with significantly better performance, thanks to its non-thread-safe design, and its support for advanced SQL features like JOINs and subqueries that alternatives like dbr may lack.
Fluent SQL generation for golang
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Offers a chainable, readable API for building SQL queries, making code intuitive and reducing errors compared to raw string concatenation, as shown in the usage examples for SELECT and INSERT.
Removes thread safety overhead with a non-thread-safe design, leading to reduced resource consumption and better benchmark results in single-threaded or properly synchronized contexts.
Includes composable features like JOINs, subqueries, and database-specific extensions for PostgreSQL (e.g., JSONB, RETURNING) and MySQL (multi-table delete), which are missing in faster alternatives like dbr.
Maintains API compatibility with Squirrel, allowing seamless switching for existing projects without code changes, as highlighted in the README's import example.
The mutable builder is inherently unsafe for concurrent use, risking race conditions if not carefully isolated in multi-goroutine applications, a trade-off admitted in the philosophy section.
While it includes PostgreSQL and MySQL extensions, it lacks built-in support for other databases like SQLite or SQL Server, requiring manual workarounds for cross-platform projects.
Benchmarks show that dbr is faster in some cases, and Sqrl's focus on features like JOINs may come at a slight performance cost compared to minimalistic builders.