Files
upstream-mirror 0f4df23290
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
snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
2026-09-16 02:17:34 +05:00

48 lines
1.0 KiB
Go

package duckdb
import (
"log"
"strings"
dw "github.com/sqlc-dev/darkwing/ast"
"github.com/sqlc-dev/sqlc/internal/debug"
"github.com/sqlc-dev/sqlc/internal/sql/ast"
)
func todo(n dw.Node) *ast.TODO {
if debug.Active {
log.Printf("duckdb.convert: Unknown node type %T\n", n)
}
return &ast.TODO{}
}
// identifier normalizes an identifier. DuckDB identifiers are
// case-insensitive (though case-preserving); the catalog matches them
// lowercased.
func identifier(id string) string {
return strings.ToLower(id)
}
func NewIdentifier(t string) *ast.String {
return &ast.String{Str: identifier(t)}
}
// schemaName normalizes a schema qualifier. DuckDB's default "main" schema
// maps to the catalog's default namespace, so it is treated as unqualified.
func schemaName(s string) string {
s = identifier(s)
if s == "main" {
return ""
}
return s
}
func parseTableName(catalog, schema, name string) *ast.TableName {
return &ast.TableName{
Catalog: identifier(catalog),
Schema: schemaName(schema),
Name: identifier(name),
}
}