snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
This commit is contained in:
23
internal/sql/format/format.go
Normal file
23
internal/sql/format/format.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package format
|
||||
|
||||
// Dialect provides SQL dialect-specific formatting behavior
|
||||
type Dialect interface {
|
||||
// QuoteIdent returns a quoted identifier if it needs quoting
|
||||
// (e.g., reserved words, mixed case identifiers)
|
||||
QuoteIdent(s string) string
|
||||
|
||||
// TypeName returns the SQL type name for the given namespace and name.
|
||||
// This handles dialect-specific type name mappings (e.g., pg_catalog.int4 -> integer)
|
||||
TypeName(ns, name string) string
|
||||
|
||||
// Param returns the placeholder for the parameter with this number.
|
||||
// numbered reports that the author wrote the number out (SQLite's ?2,
|
||||
// where a bare ? takes the next index), so engines with both forms can
|
||||
// keep the one that was written.
|
||||
// PostgreSQL uses $1, $2, etc. MySQL uses ?
|
||||
Param(n int, numbered bool) string
|
||||
|
||||
// Cast formats a type cast expression.
|
||||
// PostgreSQL uses expr::type, MySQL uses CAST(expr AS type)
|
||||
Cast(arg, typeName string) string
|
||||
}
|
||||
Reference in New Issue
Block a user