From 360020f62175b511be55f02b46bed976cb7ccc8a Mon Sep 17 00:00:00 2001 From: achmad-dev <83978538+achmad-dev@users.noreply.github.com> Date: Mon, 23 Sep 2024 21:39:35 +0700 Subject: [PATCH] Add Examples for batch.Column(n).AppendRow in columnar_insert.go (#1410) * test(issue): issue 1409 * chore(examples): add appendrow in columnar insert example * test: remove unused test file 1409_test.go --- examples/clickhouse_api/columnar_insert.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/examples/clickhouse_api/columnar_insert.go b/examples/clickhouse_api/columnar_insert.go index ae376ad287..5dc107c858 100644 --- a/examples/clickhouse_api/columnar_insert.go +++ b/examples/clickhouse_api/columnar_insert.go @@ -71,5 +71,23 @@ func ColumnInsert() error { if err := batch.Column(3).Append(col4); err != nil { return err } + + // AppendRow is a shortcut for Append(row) + if err := batch.Column(0).AppendRow(uint64(1_000)); err != nil { + return err + } + + if err := batch.Column(1).AppendRow("Golang SQL database driver"); err != nil { + return err + } + + if err := batch.Column(2).AppendRow([]uint8{1, 2, 3, 4, 5, 6, 7, 8, 9}); err != nil { + return err + } + + if err := batch.Column(3).AppendRow(time.Now()); err != nil { + return err + } + return batch.Send() }