Write SQL-shaped Go without giving up control.
Quarry helps you compose explicit SQL with safe identifiers, dialect-aware placeholders, dynamic filters, scanning helpers, and reusable query recipes. It keeps SQL visible while making the brittle parts boring.
What Quarry is for
Explicit SQL building
Compose SELECT, INSERT, UPDATE, and DELETE statements without hiding the query.
Dynamic filters
Optional predicates drop away cleanly, so search forms stay readable and deterministic.
Dialect policy
Placeholders, identifier quoting, returning support, and ILIKE behavior all follow the chosen dialect.
Optional orbiting packages
Scanning and reusable codex recipes sit beside the core builder instead of inside it.
Quick query
Quarry starts with a configured dialect and a query that still looks like SQL.
qq := quarry.New(quarry.Postgres)
q := qq.Select("id", "email").
From("users").
Where(quarry.Eq("status", "active"))
sql, args, err := q.ToSQL()
SELECT id, email FROM users WHERE status = $1
[]any{"active"}
sql, args, err. That keeps tests and review simple.
Where to go next
Get started
Install Quarry, build your first query, and learn how dialects shape output.
Read the walkthrough →Dynamic filters
See how optional predicates, safe ordering, and pagination behave together.
Open the guide →Codex and Scan
Use reusable raw queries, recipes, and hydration helpers when the query surface gets larger.
Explore Codex →Examples
Read longer, practical walkthroughs for filters, patches, raw SQL, scanning, and dialect differences.
Browse the examples →