dialect

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package dialect defines SQL rendering contracts for database-specific implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindPlaceholders added in v0.3.2

func BindPlaceholders(query string, d Dialect) string

BindPlaceholders rewrites generic positional placeholders into dialect-specific placeholders.

Types

type Capabilities

type Capabilities struct {
	UUID               bool
	JSONB              bool
	ARRAY              bool
	ENUM               bool
	GeneratedColumns   bool
	MaterializedViews  bool
	PartialIndexes     bool
	ExpressionIndexes  bool
	Gin                bool
	Gist               bool
	IdentityColumns    bool
	CompositeKeys      bool
	CompositeIndexes   bool
	PreparedStatements bool
}

Capabilities describes features supported by a SQL dialect.

type Dialect

type Dialect interface {
	Name() string
	QuoteIdent(string) string
	Placeholder(int) string
	Capabilities() Capabilities
	ColumnDefinition(*schema.Column) (string, error)
	RenderOperation(schema.Operation) (string, error)
	RenderMigration(*schema.Diff) ([]string, error)
	RenderSelect(table string, columns []string, distinct bool, joins []string, where []string, groupBy []string, having []string, orderBy []string, limit, offset *int) (string, error)
	RenderInsert(table string, columns []string, returning []string) (string, error)
	RenderUpdate(table string, set []string, where []string, returning []string) (string, error)
	RenderDelete(table string, where []string, returning []string) (string, error)
}

Dialect renders SQL for a specific database flavor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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