1 Star 0 Fork 0

flanche/clickhouse-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
write_column.go 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
Alvaro Tuso 提交于 2020-12-28 17:35 . add support for external tables
package clickhouse
import (
"database/sql"
"database/sql/driver"
"time"
"github.com/ClickHouse/clickhouse-go/lib/data"
)
// Interface for Clickhouse driver
type Clickhouse interface {
Block() (*data.Block, error)
Prepare(query string) (driver.Stmt, error)
Begin() (driver.Tx, error)
Commit() error
Rollback() error
Close() error
WriteBlock(block *data.Block) error
}
// Interface for Block allowing writes to individual columns
type ColumnWriter interface {
WriteDate(c int, v time.Time) error
WriteDateTime(c int, v time.Time) error
WriteUInt8(c int, v uint8) error
WriteUInt16(c int, v uint16) error
WriteUInt32(c int, v uint32) error
WriteUInt64(c int, v uint64) error
WriteFloat32(c int, v float32) error
WriteFloat64(c int, v float64) error
WriteBytes(c int, v []byte) error
WriteArray(c int, v interface{}) error
WriteString(c int, v string) error
WriteFixedString(c int, v []byte) error
}
func OpenDirect(dsn string) (Clickhouse, error) {
return open(dsn)
}
func (ch *clickhouse) Block() (*data.Block, error) {
if ch.block == nil {
return nil, sql.ErrTxDone
}
return ch.block, nil
}
func (ch *clickhouse) WriteBlock(block *data.Block) error {
if block == nil {
return sql.ErrTxDone
}
return ch.writeBlock(block, "")
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/flanche/clickhouse-go.git
git@gitee.com:flanche/clickhouse-go.git
flanche
clickhouse-go
clickhouse-go
master

搜索帮助