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
30 lines
945 B
Go
30 lines
945 B
Go
package clickhouse
|
|
|
|
// QuoteIdent returns a quoted identifier if it needs quoting.
|
|
// ClickHouse uses backticks or double quotes for quoting identifiers.
|
|
func (p *Parser) QuoteIdent(s string) string {
|
|
// For now, don't quote - can be extended to quote when necessary
|
|
return s
|
|
}
|
|
|
|
// TypeName returns the SQL type name for the given namespace and name.
|
|
func (p *Parser) TypeName(ns, name string) string {
|
|
if ns != "" {
|
|
return ns + "." + name
|
|
}
|
|
return name
|
|
}
|
|
|
|
// Param returns the parameter placeholder for the given number.
|
|
// ClickHouse uses {name:Type} for named parameters, but for positional
|
|
// parameters we use ? which is supported by the clickhouse-go driver.
|
|
func (p *Parser) Param(n int, numbered bool) string {
|
|
return "?"
|
|
}
|
|
|
|
// Cast returns a type cast expression.
|
|
// ClickHouse uses CAST(expr AS type) syntax, same as MySQL.
|
|
func (p *Parser) Cast(arg, typeName string) string {
|
|
return "CAST(" + arg + " AS " + typeName + ")"
|
|
}
|