dialect

package
v3.30.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Querier

type Querier interface {
	// CreateTable returns the SQL query string to create the db version table.
	CreateTable(tableName string) string
	// InsertVersion returns the SQL query string to insert a new version into the db version table.
	InsertVersion(tableName string) string
	// DeleteVersion returns the SQL query string to delete a version from the db version table.
	DeleteVersion(tableName string) string
	// GetMigrationByVersion returns the SQL query string to get a single migration by version.
	//
	// The query should return the timestamp and is_applied columns.
	GetMigrationByVersion(tableName string) string
	// ListMigrations returns the SQL query string to list all migrations in descending order by id.
	//
	// The query should return the version_id and is_applied columns.
	ListMigrations(tableName string) string
	// GetLatestVersion returns the SQL query string to get the last version_id from the db version
	// table. Returns a nullable int64 value.
	GetLatestVersion(tableName string) string
}

Querier is the interface that wraps the basic methods to create a dialect specific query.

It is intended tio be using with [database.NewStoreFromQuerier] to create a new [database.Store] implementation based on a custom querier.

type QuerierExtender

type QuerierExtender interface {
	Querier

	// TableExists returns a database-specific SQL query to check if a table exists. For example,
	// implementations might query system catalogs like pg_tables or sqlite_master. Return empty
	// string if not supported.
	TableExists(tableName string) string
}

QuerierExtender extends the Querier interface with optional database-specific optimizations. While not required, implementing these methods can improve performance.

IMPORTANT: This interface may be expanded in future versions. Implementors must be prepared to update their implementations when new methods are added.

Example compile-time check:

var _ QuerierExtender = (*CustomQuerierExtended)(nil)

In short, it's exported to allow implementors to have a compile-time check that they are implementing the interface correctly.

Jump to

Keyboard shortcuts

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