Documentation
¶
Overview ¶
Package dtql provides a 1:1, lossless, human-readable YAML serialization of dalgo's dal.StructuredQuery for the core relational read-only subset.
DTQL ("DataTug Query Language") is plain YAML over the existing dal query model — there is no bespoke grammar and no hand-written parser; a standard YAML library produces and consumes it. The package serializes an in-scope dal.StructuredQuery to a DTQL-YAML document and deserializes it back, proving a lossless round-trip in both directions.
The covered subset and its node→YAML mapping are documented in dtql/README.md.
This package imports dal but adds no YAML dependency to dal.
Index ¶
Constants ¶
const SchemaID = "https://dal-go.github.io/dtql/schema.json"
SchemaID is the canonical $id of the published DTQL JSON Schema.
Variables ¶
This section is empty.
Functions ¶
func Deserialize ¶
func Deserialize(data []byte) (dal.StructuredQuery, error)
Deserialize reconstructs a dal.StructuredQuery from a DTQL-YAML document. Malformed or schema-invalid input — unknown keys, wrong value types, missing required fields, or an unknown operator — yields a descriptive error and no (partially-populated) query.
func Equal ¶
func Equal(a, b dal.StructuredQuery) bool
Equal reports whether two in-scope dal.StructuredQuery values are structurally equal across the DTQL-covered surface: From, Columns, the Where condition tree (including inline Constant/Array values), OrderBy, Limit and Offset. It compares via the dal accessor interface, so it is agnostic to the concrete query type (e.g. a builder query vs. a deserialized one). It is the equality mechanism behind the structural round-trip guarantee. The in-scope dal nodes are value types (Comparison, GroupCondition, FieldRef, Constant, Array), so the type switches handle the value forms.
func SchemaJSON ¶
func SchemaJSON() []byte
SchemaJSON renders the DTQL JSON Schema as canonical, indented JSON. The schema document holds only strings, bools, ints, slices and maps, so marshaling cannot fail.
func SchemaYAML ¶
func SchemaYAML() []byte
SchemaYAML renders the DTQL JSON Schema as canonical YAML (identical content).
Types ¶
This section is empty.