{"id":28455707,"url":"https://github.com/questdb/go-questdb-client","last_synced_at":"2025-06-27T02:31:25.132Z","repository":{"id":41306560,"uuid":"498688005","full_name":"questdb/go-questdb-client","owner":"questdb","description":"Golang client for QuestDB's Influx Line Protocol","archived":false,"fork":false,"pushed_at":"2024-12-09T08:59:43.000Z","size":221,"stargazers_count":56,"open_issues_count":4,"forks_count":9,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-06T22:11:17.284Z","etag":null,"topics":["client-library","go","golang","questdb","questdb-ilp-client"],"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/questdb.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}},"created_at":"2022-06-01T10:20:06.000Z","updated_at":"2025-05-25T16:54:55.000Z","dependencies_parsed_at":"2024-03-11T16:50:51.669Z","dependency_job_id":"0fea5c55-149b-4419-a5c1-645750f1cc54","html_url":"https://github.com/questdb/go-questdb-client","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/questdb/go-questdb-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/questdb%2Fgo-questdb-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/questdb%2Fgo-questdb-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/questdb%2Fgo-questdb-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/questdb%2Fgo-questdb-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/questdb","download_url":"https://codeload.github.com/questdb/go-questdb-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/questdb%2Fgo-questdb-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262177599,"owners_count":23270897,"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":["client-library","go","golang","questdb","questdb-ilp-client"],"created_at":"2025-06-06T22:10:26.539Z","updated_at":"2025-06-27T02:31:25.116Z","avatar_url":"https://github.com/questdb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc reference](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/questdb/go-questdb-client/v3)\n\n# go-questdb-client\n\nGolang client for QuestDB's [Influx Line Protocol](https://questdb.io/docs/reference/api/ilp/overview/)\n(ILP) over HTTP and TCP. This library makes it easy to insert data into\n[QuestDB](https://questdb.io).\n\nThe library requires Go 1.19 or newer.\n\nFeatures:\n* [Context](https://www.digitalocean.com/community/tutorials/how-to-use-contexts-in-go)-aware API.\n* Optimized for batch writes.\n* Supports TLS encryption and ILP authentication.\n* Automatic write retries and connection reuse for ILP over HTTP.\n* Tested against QuestDB 7.3.10 and newer versions.\n\nNew in v3:\n* Supports ILP over HTTP using the same client semantics\n\nDocumentation is available [here](https://pkg.go.dev/github.com/questdb/go-questdb-client/v3).\n\n## Quickstart\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\tqdb \"github.com/questdb/go-questdb-client/v3\"\n)\n\nfunc main() {\n\tctx := context.TODO()\n\t// Connect to QuestDB running locally.\n\tsender, err := qdb.LineSenderFromConf(ctx, \"http::addr=localhost:9000;\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Make sure to close the sender on exit to release resources.\n\tdefer sender.Close(ctx)\n\t// Send a few ILP messages.\n\terr = sender.\n\t\tTable(\"trades\").\n\t\tSymbol(\"symbol\", \"ETH-USD\").\n\t\tSymbol(\"side\", \"sell\").\n\t\tFloat64Column(\"price\", 2615.54).\n\t\tFloat64Column(\"amount\", 0.00044).\n\t\tAtNow(ctx) // timestamp will be set at the server side\n\n\ttradedTs, err := time.Parse(time.RFC3339, \"2022-08-06T15:04:05.123456Z\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// You can pass a timestamp, rather than using the AtNow call\n\terr = sender.\n\t\tTable(\"trades\").\n\t\tSymbol(\"symbol\", \"BTC-USD\").\n\t\tSymbol(\"side\", \"sell\").\n\t\tFloat64Column(\"price\", 39269.98).\n\t\tFloat64Column(\"amount\", 0.001).\n\t\tAt(ctx, tradedTs)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttradedTs, err = time.Parse(time.RFC3339, \"2022-08-06T15:04:06.987654Z\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\terr = sender.\n\t\tTable(\"trades_go\").\n\t\tSymbol(\"pair\", \"GBPJPY\").\n\t\tSymbol(\"type\", \"sell\").\n\t\tFloat64Column(\"traded_price\", 135.97).\n\t\tFloat64Column(\"limit_price\", 0.84).\n\t\tInt64Column(\"qty\", 400).\n\t\tAt(ctx, tradedTs)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Make sure that the messages are sent over the network.\n\terr = sender.Flush(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\nHTTP is the recommended transport to use. To connect via TCP, set the configuration string to:\n```go\n\t// ...\n\tsender, err := qdb.LineSenderFromConf(ctx, \"tcp::addr=localhost:9009;\")\n\t// ...\n```\n\n## Pooled Line Senders\n\n**Warning: Experimental feature designed for use with HTTP senders ONLY**\n\nVersion 3 of the client introduces a `LineSenderPool`, which provides a mechanism\nto pool previously-used `LineSender`s so they can be reused without having\nto allocate and instantiate new senders.\n\nA LineSenderPool is thread-safe and can be used to concurrently obtain senders\nacross multiple goroutines.\n\nSince `LineSender`s must be used in a single-threaded context, a typical pattern is to Acquire\na sender from a `LineSenderPool` at the beginning of a goroutine and use a deferred\nexecution block to Close the sender at the end of the goroutine.\n\nHere is an example of the `LineSenderPool` Acquire, Release, and Close semantics:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\n\tqdb \"github.com/questdb/go-questdb-client/v3\"\n)\n\nfunc main() {\n\tctx := context.TODO()\n\n\tpool := qdb.PoolFromConf(\"http::addr=localhost:9000\")\n\tdefer func() {\n\t\terr := pool.Close(ctx)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tsender, err := pool.Sender(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsender.Table(\"prices\").\n\t\tSymbol(\"ticker\", \"AAPL\").\n\t\tFloat64Column(\"price\", 123.45).\n\t\tAtNow(ctx)\n\n\t// Close call returns the sender back to the pool\n\tif err := sender.Close(ctx); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n## Migration from v2\n\nv2 code example:\n```go\npackage main\n\nimport (\n\t\"context\"\n\n\tqdb \"github.com/questdb/go-questdb-client/v2\"\n)\n\nfunc main() {\n\t// Connect to QuestDB running on 127.0.0.1:9009 (ILP/TCP)\n\tsender, err := qdb.NewLineSender(context.TODO())\n\t// ...\n\tdefer sender.Close()\n\t// ...\n}\n```\n\nMigrated v3 code:\n```go\npackage main\n\nimport (\n\t\"context\"\n\n\tqdb \"github.com/questdb/go-questdb-client/v3\"\n)\n\nfunc main() {\n\t// Connect to QuestDB running on 127.0.0.1:9000 (ILP/HTTP)\n\tsender, err := qdb.NewLineSender(context.TODO(), qdb.WithHTTP())\n\t// Alternatively, you can use the LineSenderFromConf function:\n\t// sender, err := qdb.LineSenderFromConf(ctx, \"http::addr=localhost:9000;\")\n\t// ...\n\t// or you can export the \"http::addr=localhost:9000;\" config string to\n\t// the QDB_CLIENT_CONF environment variable and use the LineSenderFromEnv function:\n\t// sender, err := qdb.LineSenderFromEnv(ctx)\n\t// ...\n\tdefer sender.Close(context.TODO())\n\t// ...\n}\n```\n\nNote that the migrated code uses the HTTP sender instead of the TCP one.\n\n## Community\n\nIf you need help, have additional questions or want to provide feedback, you\nmay find in our [Community Forum](https://community.questdb.io/).\nYou can also [sign up to our mailing list](https://questdb.io/contributors/)\nto get notified of new releases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquestdb%2Fgo-questdb-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquestdb%2Fgo-questdb-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquestdb%2Fgo-questdb-client/lists"}