A fluent SQL query builder for Go that generates SQL from composable parts without being an ORM.
Squirrel is a Go library that provides a fluent, composable API for building SQL queries programmatically. It helps developers construct complex SQL statements safely and expressively, reducing the risk of SQL injection and improving code readability.
Go developers who need to generate SQL queries dynamically, especially those building applications with complex conditional query logic or requiring direct SQL control without a full ORM.
Developers choose Squirrel for its fluent, chainable API that makes SQL generation straightforward and type-safe, emphasizing simplicity and composability over the complexity of a full ORM, with built-in support for PostgreSQL features and statement caching.
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.
Chainable methods like Select() and Where() allow intuitive, step-by-step query building, making complex SQL generation straightforward and readable.
Automatically uses parameterized queries with customizable placeholders (e.g., ? for MySQL, $1 for PostgreSQL), reducing injection risks.
Special support for PostgreSQL features like RETURNING clauses and dollar-placeholder formatting, as shown in the examples with Suffix().
Includes NewStmtCache() for caching prepared statements, which can optimize performance for repeated queries when used with RunWith().
The README explicitly states that some features are poorly documented, and developers are directed to tests for guidance, hindering onboarding.
The project is labeled 'complete' and in maintenance mode, meaning slow bug fixes and no new features, which could lead to stagnation.
Lacks features like model mapping or migrations, requiring additional tools or manual work for full database interaction layers.