# doug-martin/goqu

SQL builder and query library for golang

Repository: https://github.com/doug-martin/goqu
Canonical: https://ross.abutalabs.com/products/goqu
Homepage: http://doug-martin.github.io/goqu/
Language: Go
License: MIT
License Family: permissive
Topics: sql, sql-statement, sql-builder, go, database, postgresql, mysql, sqlite, sql-query, sql-generation, postgres, querybuilder, sql-builders, sql-statements, golang
Last push: 2024-05-22T09:24:11+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 4212, "days_push": 833, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2671, forks 223 (observed 2026-08-28T04:07:09.541675+00:00)

## What it is
goqu is an expressive SQL query builder and executor library for Go, supporting multiple database dialects like PostgreSQL, MySQL, SQLite3, and SQL Server. It provides a type-safe DSL for building SELECT, INSERT, UPDATE, and DELETE statements with parameter interpolation and row scanning into structs, while explicitly not being a full ORM.

## Use cases
- build SQL queries programmatically in Go
- generate parameterized SQL for postgres, mysql, or sqlite
- scan query results into Go structs or primitive values
- write database-agnostic queries across multiple SQL dialects
- catch SQL construction errors at compile time with an expressive DSL
- interpolate query parameters for debugging logged SQL
- build insert, multi-insert, update, and delete statements

## When to choose
- you want programmatic SQL generation without a full ORM's associations and hooks
- you need to target multiple SQL dialects with one query-building API
- you prefer mixing hand-written SQL with builder-generated queries
- you want compile-time safety for common SQL expression construction

## When to avoid
- you need ORM features like associations, hooks, or migrations - use gorm instead
- you want to write raw SQL exclusively without a builder layer
- you need every database-specific SQL nuance, since goqu covers only common expressions

## Facets
- artifact type: library
- maturity: stable
- function: database, orm, serialization
- domain: databases, developer-tools, backend
- platform: go, windows, cross-platform
- tags: sql-builder, query-builder, querybuilder, postgresql, mysql, sqlite, sqlserver, dialects, parameter-interpolation, not-an-orm, linux, macos

## Member repositories
- doug-martin/goqu (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:09.541675+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-30T02:18:07.992324+00:00, confidence not recorded.
  - readme: https://github.com/doug-martin/goqu (fetched 2026-08-28T04:07:09.541675+00:00, sha a1e3e0f6e3fa)
  - homepage: http://doug-martin.github.io/goqu/ (fetched 2026-08-29T10:00:39.863032+00:00, sha bef5d33b747d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
