{"id":16743946,"url":"https://github.com/zshipko/irmin-graphql-go","last_synced_at":"2025-04-10T13:40:37.483Z","repository":{"id":34866367,"uuid":"150663791","full_name":"zshipko/irmin-graphql-go","owner":"zshipko","description":"Go bindings to the Irmin GraphQL API","archived":false,"fork":false,"pushed_at":"2022-08-13T00:17:36.000Z","size":27,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T12:21:26.496Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zshipko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-28T00:35:57.000Z","updated_at":"2022-08-12T22:43:06.000Z","dependencies_parsed_at":"2022-08-08T02:01:34.642Z","dependency_job_id":null,"html_url":"https://github.com/zshipko/irmin-graphql-go","commit_stats":null,"previous_names":["zshipko/irmin-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Firmin-graphql-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Firmin-graphql-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Firmin-graphql-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zshipko%2Firmin-graphql-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zshipko","download_url":"https://codeload.github.com/zshipko/irmin-graphql-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225937,"owners_count":21068087,"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-13T01:42:03.314Z","updated_at":"2025-04-10T13:40:37.463Z","avatar_url":"https://github.com/zshipko.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# irmin-graphql-go\n\nGo bindings to [Irmin](https://github.com/mirage/irmin) using GraphQL.\n\n## Installation\n\n```shell\n$ go get -u github.com/zshipko/irmin-graphql-go\n```\n\n## Getting started\n\nThe following example will print the commit hash of the current `HEAD` of the main branch:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"context\"\n\n    \"github.com/zshipko/irmin-graphql-go\"\n)\n\nfunc main(){\n    client := irmin.New(\"http://localhost:8080/graphql\", nil)\n    if client == nil {\n        panic(\"Unable to connect to irmin-graphql server\")\n    }\n\n    main := client.Main(context.Background())\n    fmt.Println(main.Head.Hash)\n}\n```\n\n## Writing custom queries\n\n`irmin-go` provides many predefined queries, but at some point you may need to define your own query. Thanks to [github.com/shurcooL/graphql](https://github.com/shurcooL/graphql) this is very simple:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/shurcooL/graphql\"\n\t\"github.com/zshipko/irmin-go\"\n)\n\nfunc main() {\n\tclient := irmin.New(\"http://localhost:8080/graphql\", nil)\n\tif client == nil {\n\t\tpanic(\"Unable to connect to irmin-graphql server\")\n\t}\n\n\tvar query struct {\n\t  Main struct {\n      Tree struct {\n\t\t\t  Get *graphql.String `graphql:\"get(key: $key)\"`\n      }\n\t\t}\n\t}\n\n\tkeys := map[string]interface{}{\n\t\t\"key\": \"a/b/c\",\n\t}\n\n\terr := client.Client.Query(context.Background(), \u0026query, keys)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif query.Main.Tree.Get == nil {\n\t\tlog.Println(\"NULL\")\n\t} else {\n\t\tlog.Println(*query.Main.Tree.Get)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzshipko%2Firmin-graphql-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzshipko%2Firmin-graphql-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzshipko%2Firmin-graphql-go/lists"}