Documentation
¶
Index ¶
- Constants
- func DelClient(names ...string)
- func Init(configs ...Config) (err error)
- type BaseModel
- type Config
- type GoClickHouse
- func (cli *GoClickHouse) Close() error
- func (cli *GoClickHouse) Conn() driver.Conn
- func (cli *GoClickHouse) DB() *sql.DB
- func (cli *GoClickHouse) DeletePartitionData(ctx context.Context, tableName string, partition string, startID, endID uint64) error
- func (cli *GoClickHouse) DropPartition(ctx context.Context, tableName, partition string) error
- func (cli *GoClickHouse) GetPartitionIDRange(ctx context.Context, tableName, partition string) (min, max uint64, err error)
- func (cli *GoClickHouse) GetPartitions(ctx context.Context, tableName string) ([]PartitionInfo, error)
- func (cli *GoClickHouse) OptimizePartition(context context.Context, tableName string, isFinal bool, partitions ...string) error
- type PartitionInfo
Constants ¶
View Source
const ( MaxSizeToDelete = 50 * 1024 * 1024 * 1024 // 50GB in bytes BatchSizeToDelete = 10000000 // 每批删除的记录数 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Name string `yaml:"Name" json:"name,optional"` //Driver string `yaml:"Driver" json:"driver,optional"` Addr []string `yaml:"Addr" json:"addr,optional"` User string `yaml:"User" json:"user,optional"` Password string `yaml:"Password" json:"password,optional"` Database string `yaml:"Database" json:"database,optional"` DialTimeout int32 `yaml:"DialTimeout" json:"dialTimeout,optional"` // default 30 second MaxIdleConn int `yaml:"MaxIdleConn" json:"maxIdleConn,optional"` // default 5 second MaxOpenConn int `yaml:"MaxOpenConn" json:"maxOpenConn,optional"` // default 10 second MaxExecutionTime int `yaml:"MaxExecutionTime" json:"maxExecutionTime,optional"` // default 60 second ConnMaxLifetime int `yaml:"ConnMaxLifetime" json:"connMaxLifetime,optional"` //seconds 60 * 60(1hour) TLS bool `yaml:"TLS" json:"tls,optional"` // tls true 时都会启用https 否则http InsecureSkipVerify bool `yaml:"InsecureSkipVerify" json:"insecureSkipVerify,optional"` // tls true 才会生效 AutoPing bool `yaml:"AutoPing" json:"autoPing,optional"` Debug bool `yaml:"Debug" json:"debug,optional"` }
type GoClickHouse ¶
type GoClickHouse struct {
// contains filtered or unexported fields
}
func Default ¶ added in v1.2.83
func Default() *GoClickHouse
func GetClient ¶ added in v1.2.83
func GetClient(names ...string) *GoClickHouse
func New ¶
func New(conf Config) (cli *GoClickHouse, err error)
func (*GoClickHouse) Close ¶ added in v1.2.184
func (cli *GoClickHouse) Close() error
func (*GoClickHouse) Conn ¶ added in v1.2.142
func (cli *GoClickHouse) Conn() driver.Conn
func (*GoClickHouse) DB ¶ added in v1.2.83
func (cli *GoClickHouse) DB() *sql.DB
func (*GoClickHouse) DeletePartitionData ¶ added in v1.2.184
func (cli *GoClickHouse) DeletePartitionData(ctx context.Context, tableName string, partition string, startID, endID uint64) error
删除分区内的部分数据
func (*GoClickHouse) DropPartition ¶ added in v1.2.184
func (cli *GoClickHouse) DropPartition(ctx context.Context, tableName, partition string) error
删除整个分区
func (*GoClickHouse) GetPartitionIDRange ¶ added in v1.2.184
func (cli *GoClickHouse) GetPartitionIDRange(ctx context.Context, tableName, partition string) (min, max uint64, err error)
获取分区内的最小和最大ID
func (*GoClickHouse) GetPartitions ¶ added in v1.2.184
func (cli *GoClickHouse) GetPartitions(ctx context.Context, tableName string) ([]PartitionInfo, error)
func (*GoClickHouse) OptimizePartition ¶ added in v1.2.184
func (cli *GoClickHouse) OptimizePartition(context context.Context, tableName string, isFinal bool, partitions ...string) error
OPTIMIZE
type PartitionInfo ¶ added in v1.2.184
获取分区信息
Click to show internal directories.
Click to hide internal directories.