Quarry Docs
GitHub
Reference

Core Builders and Predicates

The root package stays focused on SQL composition: builders, identifiers, predicates, raw fragments, and dialect policy.

Quarry logo

Builders

Builder Use it for Notes
qq.Select(...) Render SELECT queries. Supports joins, grouping, having, ordering, pagination, prefixes, and suffixes.
qq.InsertInto(...) Render INSERT queries. Supports multi-row values, maps, and RETURNING where the dialect allows it.
qq.Update(...) Render UPDATE queries. Supports Set, SetMap, SetIf, SetOptional, WHERE, and RETURNING.
qq.DeleteFrom(...) Render DELETE queries. Supports WHERE, prefixes, suffixes, and RETURNING where supported.

Safe identifiers

Use quarry.T, quarry.C, and the identifier helpers page when you want Quarry to quote identifiers safely.

users := quarry.T("users").As("u")
q := qq.Select(users.Col("id"), users.Col("email")).
    From(users)

Predicates

Comparison

Eq, Neq, Gt, Gte, Lt, and Lte.

Membership

In, NotIn, TupleIn, and Any.

Grouping

And, Or, and Not compose nested boolean logic.

Existence

Exists and NotExists wrap subqueries safely.

Truthful errors

  • Nil and invalid builders return errors from ToSQL.
  • Unsupported dialect features, placeholder mismatches, and builder-state failures are documented in the errors reference page.
  • The implementation uses wrapped sentinels so tests can rely on errors.Is.