DQL
1.x
Docs/DQL/Introduction
Open

Reading2 min
Updated2 Aug 2026
Sourcev1/index.mdx

DQL

DQL is a declarative query language for Go. You describe what you want as a document. DQL plans it, pushes down what the database can do, and finishes the rest in memory.

from:
  dataset: spaces
where:
  field: parent_id
  op: "=="
  value: "$parentId"
orderBy:
  - field: sort_order
    dir: asc

There is also a pipe mode: an ordered chain of operators applied to a stream of rows.

from:
  dataset: events
pipe:
  - op: filter
    where: { field: status, op: "==", value: "open" }
  - op: aggregate
    groupBy: [assignee]
    aggregate: [{ fn: count, as: total }]
  - op: sortLimit
    orderBy: [{ field: total, dir: desc }]
    limit: 10
Note

DQL is the Data Query Language. It describes queries over whatever data a host exposes, without assuming anything about what that data means.

Install01

go get github.com/xraph/dql

What is in the box02

PackagePurpose
dslThe document types: QueryDSL, clauses, plan types
parserParse and validate a document, classic or pipe mode
plannerDecide what pushes down to SQL and what does not
sqlgenEmit SQL and its arguments from a plan
processorFinish in memory: computed columns, expression filters, sort
pipeThe operator library: reshape, textual, quality, time, set ops
execRun a plan against a database/sql-shaped connection
expandTurn id columns into display fields
scopePartition and tenant scoping

Bring your own database03

exec.SQLQuerier is deliberately the shape database/sql already has, so anything you already use satisfies it, including a pooled or instrumented wrapper.

type SQLQuerier interface {
	Query(ctx context.Context, sql string, args ...any) (SQLRows, error)
}

Status04

DQL was in production use as an embedded query engine before being published as a standalone project. The document format is stable.

Next05