Files
PandeyandGitHub 7ab8f8e001 feat: rename module to SigNoz and support clickhouse-go v2.44.0 (#4)
## Why

`clickhouse-go/v2` **v2.44.0** added a new method `HasData() bool` to
the `driver.Rows` interface. SigNoz needs to upgrade to v2.44.0 (it
fixes a connection-pool slot leak — `acquire conn timeout` — introduced
in v2.43.0 via PRs #1759/#1795), but this mock's `*Rows` did not
implement `HasData()`, so it no longer satisfies `driver.Rows` and
breaks the build.

This ports the mock into a SigNoz-owned module and adds the missing
method.

## What

- Rename module path `github.com/srikanthccv/ClickHouse-go-mock` →
`github.com/SigNoz/clickhouse-go-mock` (incl. example imports).
- Bump `github.com/ClickHouse/clickhouse-go/v2` `v2.43.0` → `v2.44.0`.
- Implement `Rows.HasData()` to satisfy the v2.44.0 `driver.Rows`
interface (mirrors `Next()` semantics).
- Fix `non-constant format string in call to fmt.Errorf` vet errors
flagged by the current Go toolchain.

## Verification

- `go build ./...` ✅
- `go vet ./...` ✅
- `go test ./...` ✅
2026-05-29 23:51:54 +05:30

25 lines
601 B
Go

package main
import (
"context"
"log"
cmock "github.com/SigNoz/clickhouse-go-mock"
)
func main() {
mock, err := cmock.NewClickHouseNative(nil)
if err != nil {
log.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
}
mock.ExpectQuery("SELECT * FROM articles WHERE id = ?").WithArgs(1)
mock.ExpectQuery("SELECT * FROM articles WHERE id = ?").WithArgs(2)
// Querying out of order
_, err = mock.Query(context.Background(), "SELECT * FROM articles WHERE id = ?", 2)
if err == nil {
log.Fatal("an error was expected due to querying out of order")
}
}