Your first query
A tasks table on MergeTree and four queries; parameters are {name:Type} placeholders, the caller picks each id, and completing a task is an ALTER TABLE UPDATE mutation.
19 examples, in learning order. Typed {name:Type} parameters, asyncexec for ALTER UPDATE and DELETE, and a native-protocol emitter.
A tasks table on MergeTree and four queries; parameters are {name:Type} placeholders, the caller picks each id, and completing a task is an ALTER TABLE UPDATE mutation.
The ferry timetable again, where every Params field takes its name and Go type from a {name:Type} placeholder and a placeholder used twice binds once.
Ringed gulls and their sightings, where Nullable(String) gives a pointer and join_use_nulls decides whether a LEFT JOIN's unmatched row is NULL or each column's default.
One landing of fish read back column by column, printing the Go type each ClickHouse type became, from unsigned integers to UUID, Decimal and DateTime('UTC').
Chip shop orders kept as JSON text in String columns, encoded with json.Marshal and searched with JSONExtractString and JSONExtractRaw.
Harbour boats with an Enum8 status, read as the store.BoatsStatus type Seagull generates and then as the harbour's own domain.Status through a go_type override.
Hauls of fish with Array(String) and Array(UInt32) columns, landed from Go slices and read back as []string and []uint32, filtered on the server with has().
Beach huts found and booked by passing Go slices as {name:Array(T)} parameters, including an empty slice and a slice after a scalar.
One boat trip search run four ways, where each optional filter is a Nullable placeholder, its field a pointer, and a nil pointer switches the filter off.
Regatta entries listed in the order a caller picks from generated constants, with raw text adding no ORDER BY at all.
Rock pool finds read a page at a time, with a default and a maximum page size, then searched with an optional filter and a page.
Unclaimed lost property searched with filters, an order, a limit and a count chosen at run time, with unsafe columns, operators and directions refused.
A gull colony read through a recursive CTE, a CTE feeding rank() and sum() window functions, and a view, with types and nullability carried through each.
A day of tide readings written with one batch call, which the native driver sends as a single INSERT through PrepareBatch, landing as one part.
The migration files are embedded in the binary, and each start-up runs migrate.NewMigrator with the ClickHouse backend and Up, which applies only what the database lacks.
A chip shop menu priced by a lambda SQL function that a migration creates with CREATE OR REPLACE FUNCTION, called like a built-in from a query.
A harbour's berths, daily catch and species totals kept in ReplacingMergeTree, SummingMergeTree and AggregatingMergeTree tables, read with FINAL, -Merge combinators and PREWHERE.
Promenade kiosks with LowCardinality, Array, Map, Tuple and IPv4 columns, stored from Go values, read back and unrolled with ARRAY JOIN.
Fishing licences renewed and purged with ALTER TABLE UPDATE and DELETE declared asyncexec, made to wait with mutations_sync, beside a lightweight DELETE declared exec.
Some ideas belong to other engines, and some need a feature ClickHouse does not have. Each one says why, and where to read it instead.
Not written for ClickHouse yet.
See it on SQLite →ClickHouse has no upsert statement; ReplacingMergeTree collapses rows instead.
See it on SQLite →