A simple and powerful Go SQL library with a well-thought API, built on top of database/sql and pgx.
KSQL is a Go SQL library designed to simplify interactions with SQL databases by providing a well-planned API that makes learning, debugging, and avoiding common pitfalls easier. It focuses on offering helper functions for everyday operations like Insert, Patch, and Delete, along with generic querying capabilities, while being decoupled from its backend to leverage trusted technologies like pgx and database/sql.
Go developers building applications that require straightforward and reliable SQL database interactions, particularly those who value a clean API and want to avoid the complexity and common errors associated with lower-level SQL libraries.
Developers choose KSQL for its intentionally simple and well-thought API that reduces boilerplate and error handling, its flexibility in supporting multiple databases via adapters (Postgres, MySQL, SQLServer, SQLite), and its performance when used with pgx, often outperforming alternatives like GORM.
A Simple and Powerful Golang SQL Library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Every operation returns errors only once, reducing boilerplate and making debugging simpler, as highlighted in the README's error handling feature.
Works on top of trusted drivers like pgx and database/sql via adapters for Postgres, MySQL, SQLServer, and SQLite, offering backend decoupling.
Provides built-in Insert, Patch, and Delete methods that streamline common operations without manual SQL, as shown in the CRUD examples.
Allows scanning query results directly into structs, including support for joins and custom types like sql.Scanner, demonstrated in the code snippets.
Lacks an Upsert helper and automatic prepared statement caching for non-Postgres databases, as admitted in the TODO list, requiring manual implementation.
Benchmarks show it can be slower than raw pgx or sqlx with prepared statements, especially for multiple-row queries, due to limited caching outside Postgres.
Requires separate adapters for each database, adding setup overhead and potential versioning issues compared to all-in-one libraries.