sqldb

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sqldb holds the small amount of SQL dialect knowledge shared by Tern's database packages (migrate and jobs). They support SQLite and PostgreSQL through database/sql, with any driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect int

Dialect is a SQL dialect.

const (
	// SQLite is for drivers such as modernc.org/sqlite and mattn/go-sqlite3.
	SQLite Dialect = iota + 1
	// Postgres is for drivers such as pgx and lib/pq.
	Postgres
)

func Detect

func Detect(db *sql.DB) (Dialect, error)

Detect returns the dialect of db's driver.

func (Dialect) AutoID

func (d Dialect) AutoID() string

AutoID is the column type of an auto-incrementing integer primary key.

func (Dialect) Rebind

func (d Dialect) Rebind(query string) string

Rebind rewrites ? placeholders to $1, $2, … for Postgres. It leaves ? inside single-quoted strings alone.

func (Dialect) String

func (d Dialect) String() string

Jump to

Keyboard shortcuts

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