{"id":13514094,"url":"https://github.com/planetscale/planetscale-go","last_synced_at":"2025-11-25T16:04:26.777Z","repository":{"id":38184655,"uuid":"328136965","full_name":"planetscale/planetscale-go","owner":"planetscale","description":"Go client library to access the PlanetScale API","archived":false,"fork":false,"pushed_at":"2025-03-20T23:23:28.000Z","size":1148,"stargazers_count":123,"open_issues_count":3,"forks_count":12,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-20T23:27:59.639Z","etag":null,"topics":["database","go","mysql","planetscale","vitess"],"latest_commit_sha":null,"homepage":"https://www.planetscale.com","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/planetscale.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-09T11:14:35.000Z","updated_at":"2025-03-20T23:23:30.000Z","dependencies_parsed_at":"2023-02-18T01:31:13.332Z","dependency_job_id":"807b9b59-203c-44f6-8f0d-8ede04436a18","html_url":"https://github.com/planetscale/planetscale-go","commit_stats":null,"previous_names":[],"tags_count":136,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fplanetscale-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fplanetscale-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fplanetscale-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/planetscale%2Fplanetscale-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/planetscale","download_url":"https://codeload.github.com/planetscale/planetscale-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246407401,"owners_count":20772126,"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":["database","go","mysql","planetscale","vitess"],"created_at":"2024-08-01T05:00:46.269Z","updated_at":"2025-11-25T16:04:21.737Z","avatar_url":"https://github.com/planetscale.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# planetscale-go [![Go Reference](https://pkg.go.dev/badge/github.com/planetscale/planetscale-go/planetscale.svg)](https://pkg.go.dev/github.com/planetscale/planetscale-go/planetscale) [![Build status](https://badge.buildkite.com/82dafa9518fe94b3fed75db71bcfc3836faeec49816e400f2e.svg?branch=main)](https://buildkite.com/planetscale/planetscale-go)\n\nGo package to access the PlanetScale API.\n\n## Install\n\n```\ngo get github.com/planetscale/planetscale-go/planetscale\n```\n\n## Usage\n\nHere is an example application using the PlanetScale Go client. You can create\nand manage your service tokens via our [pscale\nCLI](https://github.com/planetscale/cli) with the `pscale service-token`\nsubcommand.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/planetscale/planetscale-go/planetscale\"\n)\n\nfunc main() {\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\t// Create a new PlanetScale API client with the given service token.\n\tclient, err := planetscale.NewClient(\n\t\tplanetscale.WithServiceToken(\"token-id\", os.Getenv(\"PLANETSCALE_TOKEN\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\n\t// Create a new database.\n\t_, err = client.Databases.Create(ctx, \u0026planetscale.CreateDatabaseRequest{\n\t\tOrganization: \"my-org\",\n\t\tName:         \"my-awesome-database\",\n\t\tNotes:        \"This is a test DB created via the planetscale-go API library\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create database: %v\", err)\n\t}\n\n\t// List all databases for the given organization.\n\tdatabases, err := client.Databases.List(ctx, \u0026planetscale.ListDatabasesRequest{\n\t\tOrganization: \"my-org\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to list databases: %v\", err)\n\t}\n\n\tlog.Printf(\"found %d databases:\", len(databases))\n\tfor _, db := range databases {\n\t\tlog.Printf(\"  - %q: %s\", db.Name, db.Notes)\n\t}\n\n\t// Delete a database.\n\t_, err = client.Databases.Delete(ctx, \u0026planetscale.DeleteDatabaseRequest{\n\t\tOrganization: \"my-org\",\n\t\tDatabase:     \"my-awesome-database\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to delete database: %v\", err)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fplanetscale-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplanetscale%2Fplanetscale-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplanetscale%2Fplanetscale-go/lists"}