clickhouse

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

dialect/clickhouse — the ClickHouse dialect

Placeholders (?), identifier quoting (backticks), and the capabilities this engine has.

It imports render and nothing else — which is exactly what a dialect written in another repository imports. That is the point of the layout: adding ClickHouse and adding an engine nobody has written yet are the same act, and TestDialects_ImportOnlyRender reads this package's import list and fails on anything else.

It omits both SupportsReturning and SupportsLikeEscape entirely, which is how a dialect declines a capability here: not by returning false, but by not implementing the interface, so InsertReturning against it does not compile and expr.Contains records ErrNoLikeEscape rather than emitting a clause the engine would reject. TestClickHouse_DeclinesReturning pins the first.

The constructs ClickHouse spells differently are not here. They live in the engine construct package, because a caller naming the engine it builds for should not have to import several hundred constructs to do it.

Full documentation

docs/dialect/README.md covers all three and how to write a fourth; docs/dialects.md covers what a dialect decides and how a construct fails closed under the wrong one.

Documentation

Overview

Package clickhouse is the ClickHouse dialect: positional placeholders and backtick-quoted identifiers.

It imports the render layer and nothing else. See the postgres package in this directory for why each dialect is its own package.

The constructs that only ClickHouse has live in github.com/ubgo/sqlb/ch.

Index

Constants

Name is the engine name this dialect reports. Engine packages guard on it.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect struct{}

Dialect renders ? placeholders and backtick-quoted identifiers.

It deliberately does not satisfy render.Returning. ClickHouse has no RETURNING, so a write builder asked for one fails at Build instead of producing a statement the server rejects. Declining to implement an optional interface is how a dialect says "I cannot do this" without lying.

func (Dialect) Name

func (Dialect) Name() string

Name reports "clickhouse".

func (Dialect) Placeholder

func (Dialect) Placeholder(int) string

Placeholder renders ?. ClickHouse placeholders are positional.

func (Dialect) QuoteIdent

func (Dialect) QuoteIdent(ident string) string

QuoteIdent backtick-quotes an identifier, doubling any embedded backtick. ClickHouse uses backticks where Postgres and SQLite use double quotes, which is most of what a dialect is for.

Jump to

Keyboard shortcuts

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