engine

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Name returns the engine name (postgresql, mysql, sqlite).
	Name() string

	// ParamPlaceholder returns the parameter placeholder for the given index (1-based).
	// PostgreSQL: $1, $2, $3
	// MySQL/SQLite: ?, ?, ?
	ParamPlaceholder(index int) string

	// BoolCast wraps an expression with a boolean cast if needed.
	// PostgreSQL: expr::boolean
	// MySQL/SQLite: expr (no cast)
	BoolCast(expr string) string

	// TimestampFunc returns the current timestamp function.
	// PostgreSQL: now()
	// MySQL: NOW()
	// SQLite: datetime('now')
	TimestampFunc() string

	// SupportsReturning returns true if the engine supports RETURNING clause.
	SupportsReturning() bool

	// BatchInsertStrategy returns the batch insert strategy.
	// PostgreSQL: copyfrom (uses pgx CopyFrom)
	// MySQL/SQLite: multi-values
	BatchInsertStrategy() string
}

Engine abstracts database-specific SQL dialect differences.

func New

func New(name string) (Engine, error)

New creates an Engine for the given engine name.

Jump to

Keyboard shortcuts

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