{"id":15787718,"url":"https://github.com/srikanthccv/clickhouse-go-mock","last_synced_at":"2026-03-14T16:25:37.653Z","repository":{"id":103416567,"uuid":"562171148","full_name":"srikanthccv/ClickHouse-go-mock","owner":"srikanthccv","description":"a mock library implementing support for clickhouse-go/v2/lib/driver","archived":false,"fork":false,"pushed_at":"2025-06-21T03:49:58.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-09T01:04:24.454Z","etag":null,"topics":["clickhouse","driver","golang","mock","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srikanthccv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-05T14:26:25.000Z","updated_at":"2025-06-21T03:49:07.000Z","dependencies_parsed_at":"2023-09-30T10:15:42.268Z","dependency_job_id":"f89e9f70-1c54-4a2e-85b6-ff5accc65900","html_url":"https://github.com/srikanthccv/ClickHouse-go-mock","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/srikanthccv/ClickHouse-go-mock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanthccv%2FClickHouse-go-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanthccv%2FClickHouse-go-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanthccv%2FClickHouse-go-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanthccv%2FClickHouse-go-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srikanthccv","download_url":"https://codeload.github.com/srikanthccv/ClickHouse-go-mock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srikanthccv%2FClickHouse-go-mock/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264373756,"owners_count":23598078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clickhouse","driver","golang","mock","testing"],"created_at":"2024-10-04T21:21:48.077Z","updated_at":"2026-03-14T16:25:32.598Z","avatar_url":"https://github.com/srikanthccv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ClickHouse-go-mock\n\nA mock library implementing support for [clickhouse-go/v2/lib/driver](https://pkg.go.dev/github.com/ClickHouse/clickhouse-go/v2/lib/driver)\n\n\n## Install\n\n```go\ngo get github.com/srikanthccv/ClickHouse-go-mock\n```\n\n## Quick Start\n\n```go\n\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/ClickHouse/clickhouse-go/v2\"\n\tcmock \"github.com/srikanthccv/ClickHouse-go-mock\"\n)\n\ntype Video struct {\n\tName    string `db:\"name\"`\n\tTitle   string `db:\"title\"`\n\tContent string `db:\"content\"`\n}\n\nfunc fetchVideos(conn clickhouse.Conn) (*Video, error) {\n\tvar video Video\n\tif _, err := conn.Query(context.TODO(), \"SELECT name, title, content FROM videos WHERE name LIKE ?\", \"%Cocomelon%\"); err != nil {\n\t\treturn nil, err\n\t}\n\treturn \u0026video, nil\n}\n\nfunc main() {\n\tmock, err := cmock.NewClickHouseNative(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"an error '%s' was not expected when opening a stub database connection\", err)\n\t}\n\n\tmock.ExpectQuery(\"SELECT name, title, content FROM videos WHERE name LIKE ?\").WithArgs(\"%Cocomelon%\")\n\t_, err = fetchVideos(mock)\n\tif err != nil {\n\t\tlog.Fatalf(\"an error '%s' was not expected when querying a statement\", err)\n\t}\n\n\tif err := mock.ExpectationsWereMet(); err != nil {\n\t\tlog.Fatalf(\"there were unfulfilled expectations: %s\", err)\n\t}\n}\n```\n\n## Documentation\n\nPlease see the package documentation at [godoc.org](https://pkg.go.dev/github.com/srikanthccv/ClickHouse-go-mock).\n\nAnd tests are the best documentation, see [clickconnmock_test.go](clickconnmock_test.go).\n\n## License\n\nThe Apache License, Version 2.0 - see [LICENSE](LICENSE) for more details.\n\n## Credits\n\nThis library is built on top of [clickhouse-go](https://github.com/ClickHouse/clickhouse-go) and [sqlmock](https://github.com/DATA-DOG/go-sqlmock)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrikanthccv%2Fclickhouse-go-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrikanthccv%2Fclickhouse-go-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrikanthccv%2Fclickhouse-go-mock/lists"}