feature

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: BSD-2-Clause Imports: 3 Imported by: 14

Documentation

Overview

Package feature defines flags that represent optional SQL dialect capabilities. Each dialect (PostgreSQL, MySQL, SQLite, MSSQL) declares which features it supports by combining flags with the bitwise OR operator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feature

type Feature = internal.Flag

Feature is a bit flag representing an optional SQL dialect capability.

const (

	// CTE enables Common Table Expressions (WITH ... AS ...) syntax.
	CTE Feature = 1 << iota
	// WithValues enables WITH ... (VALUES ...) syntax for inline value lists.
	WithValues
	// Returning enables the RETURNING clause to return rows affected by DML statements.
	Returning
	// Output enables the OUTPUT clause, the MSSQL equivalent of RETURNING.
	Output
	// DefaultPlaceholder enables the DEFAULT keyword as a placeholder in INSERT value lists.
	DefaultPlaceholder
	// DoubleColonCast enables PostgreSQL-style :: type cast syntax.
	DoubleColonCast
	// ValuesRow enables VALUES ROW(...) syntax.
	ValuesRow
	// CompositeIn enables WHERE (A, B) IN ((N, NN), (N, NN), ...) composite comparison syntax.
	CompositeIn

	// OffsetFetch enables OFFSET ... FETCH NEXT syntax (MSSQL).
	OffsetFetch
	// SelectExists enables EXISTS subquery expressions.
	SelectExists

	// InsertReturning enables INSERT ... RETURNING syntax.
	InsertReturning
	// InsertTableAlias enables table alias support in INSERT statements.
	InsertTableAlias
	// InsertOnConflict enables INSERT ... ON CONFLICT syntax (PostgreSQL, SQLite).
	InsertOnConflict
	// InsertOnDuplicateKey enables INSERT ... ON DUPLICATE KEY syntax (MySQL).
	InsertOnDuplicateKey
	// InsertIgnore enables INSERT IGNORE syntax to silently skip conflicting rows (MySQL).
	InsertIgnore

	// UpdateFromTable enables UPDATE ... FROM ... syntax for joining tables in updates.
	UpdateFromTable
	// UpdateMultiTable enables multi-table UPDATE syntax (MySQL).
	UpdateMultiTable
	// UpdateTableAlias enables table alias support in UPDATE statements.
	UpdateTableAlias
	// UpdateOrderLimit enables UPDATE ... ORDER BY ... LIMIT syntax.
	UpdateOrderLimit

	// DeleteReturning enables DELETE ... RETURNING syntax.
	DeleteReturning
	// DeleteTableAlias enables table alias support in DELETE statements.
	DeleteTableAlias
	// DeleteOrderLimit enables DELETE ... ORDER BY ... LIMIT syntax.
	DeleteOrderLimit

	// Merge enables MERGE ... USING ... ON ... WHEN syntax for upsert operations.
	Merge
	// MergeReturning enables MERGE ... RETURNING syntax.
	MergeReturning

	// TableCascade enables CASCADE support for DROP TABLE and related operations.
	TableCascade
	// TableIdentity enables table-level IDENTITY property (MSSQL).
	TableIdentity
	// TableTruncate enables TRUNCATE TABLE support.
	TableTruncate
	// TableNotExists enables IF NOT EXISTS / IF EXISTS syntax for CREATE TABLE and DROP TABLE.
	TableNotExists
	// AlterColumnExists enables ADD/DROP COLUMN IF NOT EXISTS / IF EXISTS syntax.
	AlterColumnExists
	// CreateIndexIfNotExists enables CREATE INDEX IF NOT EXISTS syntax.
	CreateIndexIfNotExists

	// AutoIncrement enables AUTO_INCREMENT syntax for auto-generated columns (MySQL).
	AutoIncrement
	// Identity enables IDENTITY column syntax for auto-generated columns (MSSQL).
	Identity
	// GeneratedIdentity enables GENERATED ALWAYS AS IDENTITY syntax (PostgreSQL).
	GeneratedIdentity

	// FKDefaultOnAction indicates that FK ON UPDATE/ON DELETE has the default value NO ACTION.
	FKDefaultOnAction
	// MSSavepoint enables Microsoft SQL Server savepoint support.
	MSSavepoint
)

type NotSupportError added in v1.2.9

type NotSupportError struct {
	Flag Feature
}

NotSupportError is returned when an operation requires a feature that the current dialect does not support.

func NewNotSupportError added in v1.2.9

func NewNotSupportError(flag Feature) *NotSupportError

NewNotSupportError returns a NotSupportError for the given feature flag.

func (*NotSupportError) Error added in v1.2.9

func (err *NotSupportError) Error() string

Jump to

Keyboard shortcuts

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