{"id":13675800,"url":"https://github.com/the-hotels-network/go-tinybird","last_synced_at":"2026-02-17T14:11:07.545Z","repository":{"id":90497610,"uuid":"527876590","full_name":"the-hotels-network/go-tinybird","owner":"the-hotels-network","description":"Module to getting data through the Tinybird API","archived":false,"fork":false,"pushed_at":"2026-02-03T16:31:44.000Z","size":6645,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-04T05:42:30.357Z","etag":null,"topics":["golang","tinybird"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the-hotels-network.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-23T07:17:50.000Z","updated_at":"2026-02-03T16:39:56.000Z","dependencies_parsed_at":"2023-11-13T19:30:47.954Z","dependency_job_id":"3a11cf43-e7ce-4cc9-a583-3b62c44e64d4","html_url":"https://github.com/the-hotels-network/go-tinybird","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/the-hotels-network/go-tinybird","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-hotels-network%2Fgo-tinybird","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-hotels-network%2Fgo-tinybird/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-hotels-network%2Fgo-tinybird/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-hotels-network%2Fgo-tinybird/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-hotels-network","download_url":"https://codeload.github.com/the-hotels-network/go-tinybird/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-hotels-network%2Fgo-tinybird/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29546842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T13:00:00.370Z","status":"ssl_error","status_checked_at":"2026-02-17T12:57:14.072Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["golang","tinybird"],"created_at":"2024-08-02T12:01:03.614Z","updated_at":"2026-02-17T14:11:07.525Z","avatar_url":"https://github.com/the-hotels-network.png","language":"Go","funding_links":[],"categories":["SDKs \u0026 Utilities 🧰"],"sub_categories":[],"readme":"# Go-Tinybird\n\nA [Tinybird](https://www.tinybird.co/) module for Go. It provides an easy and standard way of getting data through the Tinybird API.\n\n## Features\n\n- Lightweight and fast. Native Go implementation, no C-bindings.\n- Connection pooling for Tinybird.\n- JSON, [NDJSON](http://ndjson.org/) and CSV response formats.\n- Parallel HTTP requests.\n- Send [events](https://www.tinybird.co/docs/forward/get-data-in/events-api) to data sources.\n- Read and write values in nested JSON structures using dot-path access.\n- Auto cast string values to their inferred Go types (`int64`, `float64`).\n- Custom logic `before` and `after` request execution (e.g. caching).\n- Shared logger with [logrus](https://github.com/sirupsen/logrus).\n- Test your code with mocks.\n\n## Requirements\n\nGo 1.24 or higher.\n\n## Installation\n\n```bash\ngo get -u github.com/the-hotels-network/go-tinybird\n```\n\n## Quickstart\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\n\t\"github.com/the-hotels-network/go-tinybird\"\n)\n\nfunc main() {\n\tparams := url.Values{}\n\tparams.Add(\"start_date\", \"2022-05-01\")\n\tparams.Add(\"end_date\", \"2022-05-30\")\n\tparams.Add(\"property_id\", \"1234\")\n\n\treq := tinybird.Request{\n\t\tMethod: http.MethodGet,\n\t\tPipe: tinybird.Pipe{\n\t\t\tName:       \"tinybird_endpoint\",\n\t\t\tParameters: params,\n\t\t\tWorkspace: tinybird.Workspace{\n\t\t\t\tToken: \"token-demo\",\n\t\t\t},\n\t\t},\n\t}\n\n\terr := req.Execute()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tres := req.Response\n\tfmt.Println(\"Status:\", res.Status)\n\tfmt.Println(\"Error:\", res.Error)\n\tfmt.Println(\"Data:\", res.Data)\n}\n```\n\n## Working with Data\n\nThe `Data` type (`[]Row`) provides methods to read and write values using dot-separated paths:\n\n```go\nres := req.Response\n\n// Get a value by key\nval := res.Data.FetchOne(\"revenue\")\n\n// Get a nested value using dot-path\nval := res.Data.Get(\"stats.daily.total\")\n\n// Set a value\nres.Data.Set(\"stats.daily.total\", 100)\n\n// Set with auto cast (converts numeric strings to int64 or float64)\nres.Data.SetWithAutoCast(\"price\", \"99.99\")   // stores float64(99.99)\nres.Data.SetWithAutoCast(\"count\", \"42\")       // stores int64(42)\nres.Data.SetWithAutoCast(\"label\", \"hello\")    // stores \"hello\" (unchanged)\n```\n\nThe `AutoCast` function can also be used standalone:\n\n```go\ntinybird.AutoCast(\"42\")    // int64(42)\ntinybird.AutoCast(\"3.14\")  // float64(3.14)\ntinybird.AutoCast(\"hello\") // \"hello\"\ntinybird.AutoCast(99)      // 99 (non-string values pass through)\n```\n\n## Parallel Requests\n\n```go\nreqs := tinybird.Requests{}\n\nreqs.Add(tinybird.Request{\n\tMethod: http.MethodGet,\n\tPipe: tinybird.Pipe{\n\t\tName:      \"endpoint_bookings\",\n\t\tWorkspace: tinybird.Workspace{Token: \"token-demo\"},\n\t},\n})\n\nreqs.Add(tinybird.Request{\n\tMethod: http.MethodGet,\n\tPipe: tinybird.Pipe{\n\t\tName:      \"endpoint_searches\",\n\t\tWorkspace: tinybird.Workspace{Token: \"token-demo\"},\n\t},\n})\n\nreqs.Execute()\n\nfor _, req := range reqs {\n\tfmt.Println(req.Response.Data)\n}\n```\n\n## Events\n\n```go\nevent := tinybird.Event{\n\tMethod:     http.MethodGet,\n\tDatasource: \"my_datasource\",\n\tWorkspace:  tinybird.Workspace{Token: \"token-demo\"},\n}\n\nerr := event.Send(map[string]any{\"key\": \"value\"})\n```\n\n## Response Formats\n\n### NDJSON\n\nSet the format on the pipe or via the `TB_NDJSON` environment variable:\n\n```go\nreq := tinybird.Request{\n\tPipe: tinybird.Pipe{\n\t\tName:   \"endpoint\",\n\t\tFormat: tinybird.NDJSON,\n\t},\n}\n```\n\n### CSV\n\n```go\nreq := tinybird.Request{\n\tPipe: tinybird.Pipe{\n\t\tName:   \"endpoint\",\n\t\tFormat: tinybird.CSV,\n\t},\n}\n// Access raw body: req.Response.Body\n```\n\n## Before / After Hooks\n\nAdd custom logic around request execution, for example a cache layer:\n\n```go\nreq := tinybird.Request{\n\tBefore: func(r *tinybird.Request) error {\n\t\t// Check cache before hitting the API\n\t\treturn nil\n\t},\n\tAfter: func(r *tinybird.Request) error {\n\t\t// Store response in cache\n\t\treturn nil\n\t},\n}\n```\n\n## Configuration\n\n| Variable | Default | Description |\n|---|---|---|\n| `tinybird.URL_BASE` | `https://api.tinybird.co` | Base API URL |\n| `tinybird.Client` | default pool | Custom `HTTPClient` |\n| `tinybird.MAX_IDLE_CONNS` | - | Max idle connections |\n| `tinybird.MAX_CONNS_PER_HOST` | - | Max connections per host |\n| `tinybird.MAX_IDLE_CONNS_PER_HOST` | - | Max idle connections per host |\n| `tinybird.CONNS_TIMEOUT` | - | Connection timeout (seconds) |\n\n## Tests\n\n```bash\nmake tests\n```\n\n## More Examples\n\nSee the [example directory](https://github.com/the-hotels-network/go-tinybird/tree/main/example) for complete working examples.\n\n## Local Development\n\nPoint to a local version of the module:\n\n```bash\ngo mod edit -replace github.com/the-hotels-network/go-tinybird=$HOME/go/src/github.com/the-hotels-network/go-tinybird\n```\n\nRevert:\n\n```bash\ngo mod edit -dropreplace github.com/the-hotels-network/go-tinybird\ngo get -u\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-hotels-network%2Fgo-tinybird","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-hotels-network%2Fgo-tinybird","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-hotels-network%2Fgo-tinybird/lists"}