Documentation
¶
Index ¶
- func CloseAll()
- func FreeClusterConn()
- func InitClusterConn(chCfg *config.ClickHouseConfig) (err error)
- func NumShard() (cnt int)
- type Conn
- func (c *Conn) AsyncInsert(query string, wait bool) error
- func (c *Conn) Close() error
- func (c *Conn) Exec(query string, args ...any) error
- func (c *Conn) Ping() error
- func (c *Conn) Query(query string, args ...any) (*Rows, error)
- func (c *Conn) QueryRow(query string, args ...any) *Row
- func (c *Conn) Write(prepareSQL string, rows model.Rows, idxBegin, idxEnd int) (numBad int, err error)
- type Row
- type Rows
- type ShardConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FreeClusterConn ¶
func FreeClusterConn()
func InitClusterConn ¶
func InitClusterConn(chCfg *config.ClickHouseConfig) (err error)
Each shard has a pool.Conn which connects to one replica inside the shard. We need more control than replica single-point-failure.
Types ¶
type Conn ¶ added in v0.5.0
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) AsyncInsert ¶ added in v0.7.0
type ShardConn ¶
type ShardConn struct {
// contains filtered or unexported fields
}
ShardConn a datastructure for storing the clickhouse connection
func GetShardConn ¶
GetShardConn select a clickhouse shard based on batchNum
func (*ShardConn) GetReplica ¶
GetReplica returns the replica to which db connects
func (*ShardConn) NextGoodReplica ¶
func (sc *ShardConn) NextGoodReplica(ctx context.Context, failedVer int) (db *Conn, dbVer int, err error)
NextGoodReplica connects to next good replica
func (*ShardConn) SubmitTask ¶ added in v0.5.0
Click to show internal directories.
Click to hide internal directories.