# huandu/go-sqlbuilder

A flexible and powerful SQL string builder library plus a zero-config ORM.

Repository: https://github.com/huandu/go-sqlbuilder
Canonical: https://ross.abutalabs.com/products/go-sqlbuilder
Homepage: https://pkg.go.dev/github.com/huandu/go-sqlbuilder
Language: Go
License: MIT
License Family: permissive
Topics: sql-builder, orm, sql, go, mysql, postgresql, sqlite, hiveql, lightweight, well-tested, database, sqlx
Last push: 2026-08-21T12:25:50+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 98, release rhythm 86, longevity 100
- inputs: {"age_days": 3171, "days_push": 12, "days_rel": 12, "gap_med": 45.5, "n_releases_24m": 15}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1726, forks 140 (observed 2026-08-28T04:05:28.200128+00:00)

## What it is
A Go library for building SQL strings programmatically, compatible with the standard library database/sql interfaces, plus a lightweight zero-config ORM based on Go structs. It is driver-agnostic and supports dialects like MySQL, PostgreSQL, SQLite, and HiveQL.

## Use cases
- build parameterized SQL queries in Go without string concatenation
- generate SQL for multiple database dialects from one codebase
- map Go structs to database tables with a lightweight ORM
- construct complex WHERE and JOIN clauses dynamically
- interpolate query arguments safely into SQL strings
- build nested queries and subselects in Go

## When to choose
- you want fine-grained control over generated SQL without a heavy ORM
- you need to support multiple SQL dialects with the same query-building code
- you use custom or non-standard database drivers and just need SQL string construction
- you want a lightweight struct-to-table mapping with zero configuration

## When to avoid
- you need a full-featured ORM with migrations, relations, and change tracking
- you prefer schema-first code generation over runtime query building
- you work with NoSQL databases or non-SQL data stores

## Facets
- artifact type: library
- maturity: stable
- function: orm, database, serialization
- domain: databases, developer-tools, backend
- platform: go, windows, cross-platform
- tags: sql-builder, query-builder, mysql, postgresql, sqlite, zero-config-orm, parameterized-queries, linux, macos

## Member repositories
- huandu/go-sqlbuilder (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:28.200128+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:32:32.231873+00:00, confidence not recorded.
  - readme: https://github.com/huandu/go-sqlbuilder (fetched 2026-08-28T04:05:28.200128+00:00, sha 4071ae17c958)
  - homepage: https://pkg.go.dev/github.com/huandu/go-sqlbuilder (fetched 2026-08-29T11:09:04.037496+00:00, sha 2e97416e5e18)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T11:09:04.050057+00:00, sha 757852027879)
- Data as of 2026-08-30T08:39:29.467469+00:00.
