{"id":17312197,"url":"https://github.com/oreqizer/go-relaygen","last_synced_at":"2025-03-27T01:14:40.467Z","repository":{"id":56491560,"uuid":"226323216","full_name":"oreqizer/go-relaygen","owner":"oreqizer","description":"Go generator for implementation-agnostic Relay utilities. :grapes:","archived":false,"fork":false,"pushed_at":"2023-12-15T11:53:18.000Z","size":16,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T06:27:41.897Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oreqizer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-12-06T12:16:09.000Z","updated_at":"2019-12-06T15:25:05.000Z","dependencies_parsed_at":"2024-12-05T09:41:41.551Z","dependency_job_id":"14fbbf95-0764-4e80-bf1a-c50cdfc70d97","html_url":"https://github.com/oreqizer/go-relaygen","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oreqizer%2Fgo-relaygen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oreqizer%2Fgo-relaygen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oreqizer%2Fgo-relaygen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oreqizer%2Fgo-relaygen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oreqizer","download_url":"https://codeload.github.com/oreqizer/go-relaygen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245761301,"owners_count":20667895,"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":[],"created_at":"2024-10-15T12:42:44.549Z","updated_at":"2025-03-27T01:14:40.445Z","avatar_url":"https://github.com/oreqizer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RelayGen\n\n[![godoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/oreqizer/go-relaygen)\n[![Build Status](https://travis-ci.org/oreqizer/go-relaygen.svg?branch=master)](https://travis-ci.org/oreqizer/go-relaygen)\n[![codecov](https://codecov.io/gh/oreqizer/go-relaygen/branch/master/graph/badge.svg)](https://codecov.io/gh/oreqizer/go-relaygen)\n\nA `go generate` based toolset for [Relay](https://facebook.github.io/relay/docs/en/graphql-server-specification.html) compliant **GraphQL** servers.\n\n\u003e An evolution of [go-relay](https://github.com/oreqizer/go-relay) project.\n\nIt ain't much but it's honest work.\n\n## API\n\nTypes and functions are located in `github.com/oreqizer/go-relaygen/relay`.\n\n### Connection\n\nRun `go run github.com/oreqizer/go-relaygen \u003cname\u003e \u003clocal id\u003e` where you want to generate your connection utilities.\n\n\u003e Supports nested ID fields, e.g. `Person.ID`\n\nThe only function you care about is `\u003cName\u003eConnectionFromArray`.\n\nMake your types satisfy the `Node` interface and create the `ConnectionArgs` object, feed it into it and you'll get a `\u003cName\u003eConnection`.\n\n```go\n//go:generate go run github.com/oreqizer/go-relaygen User LocalID\n\npackage example\n\nimport (\n\t\"github.com/oreqizer/go-relaygen/relay\"\n)\n\nconst UserType = \"User\"\n\ntype User struct {\n\tLocalID string\n\tName    string\n}\n\nfunc (u *User) ID() string {\n\treturn relay.ToGlobalID(UserType, u.LocalID)\n}\n```\n\n### IDs\n\nThere are two functions - `ToGlobalID` and `FromGlobalID`. They behave the same like the JS reference implementation.\n\n```go\nvar global = relay.ToGlobalID(\"User\", \"asdf\") // Returns a base64 encoded string\n\nvar local = relay.FromGlobalID(global) // local.Type == \"User\", local.ID == \"asdf\"\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foreqizer%2Fgo-relaygen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foreqizer%2Fgo-relaygen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foreqizer%2Fgo-relaygen/lists"}