Skip to content

Commit

Permalink
Add Examples for batch.Column(n).AppendRow in columnar_insert.go (#1410)
Browse files Browse the repository at this point in the history
* test(issue): issue 1409

* chore(examples): add appendrow in columnar insert example

* test: remove unused test file 1409_test.go
  • Loading branch information
achmad-dev authored Sep 23, 2024
1 parent 877aa63 commit 360020f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/clickhouse_api/columnar_insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

0 comments on commit 360020f

Please sign in to comment.