dialect

package
v0.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package dialect abstracts SQL dialect differences: identifier quoting, parameter placeholders, EXPLAIN wrapping, and capability negotiation.

Concrete dialect implementations live in x/providers alongside each database adapter. The heavier EXPLAIN-result parsing (cost.Explainer) and schema introspection (introspect.Introspector) also stay in x/providers because they require live database access. Capabilities drive both codegen rendering and which Gate layers are assembled per database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Returning       bool // INSERT ... RETURNING (PG has; MySQL lacks -> exec + last insert id)
	ExplainCost     bool // EXPLAIN yields a numeric cost (SQLite does not)
	ExplainAccurate bool // estimate trustworthiness (PG high; MySQL/OB medium; SQLite low)
}

Capabilities declares what a database supports. It drives codegen rendering (RETURNING or a second statement for the inserted key) and whether the cost gate assembles the Estimate layer. See the cost gate design.

type Dialect

type Dialect interface {
	Name() string
	QuoteIdent(name string) string
	Placeholder(index int) string
	Capabilities() Capabilities
}

Dialect abstracts the SQL differences core codegen needs. Implementations are stateless and safe for concurrent use.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL