ClickHouse Truncate table

API

For the full list of supported methods, see TruncateTableQueryopen in new window.

db.NewTruncateTable().

	Model(&strct).

	Table("table1"). // quotes table names
	TableExpr("table1"). // arbitrary unsafe expression
	ModelTableExpr("table1"). // overrides model table name

	IfExists().

	Exec(ctx)

Example

To truncate ClickHouse table:

_, err := db.NewTruncateTable().Model((*Span)(nil)).Exec(ctx)
if err != nil {
	panic(err)
}
Last Updated: