Skip to content

Draft: query-api(clickhouse): use type constraints for strongly typed queries

Joe Shaw requested to merge joe/generic_clickhouse_query_api into main

Some fun with generics to provide a strongly typed query API for ClickHouse that serializes types correctly.

The aim is to provide a cleaner API for both ? placeholder syntax and named native parameters with some compile time safety.

Extensible Literal type allows external type definitions, but mainly simple additions of new custom types in the package.

Go builtins (e.g. int64) still require some runtime reflection, as we can't add interface methods to these and we don't have overloading. Likewise, you cannot use type definitions like type Builtin[T GoTypes] T to make things cleaner (this doesn't compile).

Merge request reports