{"id":15785004,"url":"https://github.com/emicklei/dgraph-access","last_synced_at":"2025-09-10T21:34:35.315Z","repository":{"id":144203630,"uuid":"176600375","full_name":"emicklei/dgraph-access","owner":"emicklei","description":"helper package on top of the official Go client for DGraph","archived":false,"fork":false,"pushed_at":"2023-03-07T02:11:29.000Z","size":110,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-11T20:29:56.960Z","etag":null,"topics":["client","dgraph","golang","graph","nquad","rdf"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emicklei.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}},"created_at":"2019-03-19T21:22:35.000Z","updated_at":"2021-06-08T12:56:23.000Z","dependencies_parsed_at":"2023-06-19T03:49:57.557Z","dependency_job_id":null,"html_url":"https://github.com/emicklei/dgraph-access","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fdgraph-access","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fdgraph-access/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fdgraph-access/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emicklei%2Fdgraph-access/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emicklei","download_url":"https://codeload.github.com/emicklei/dgraph-access/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246507156,"owners_count":20788771,"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","dgraph","golang","graph","nquad","rdf"],"created_at":"2024-10-04T20:20:30.498Z","updated_at":"2025-03-31T17:26:22.171Z","avatar_url":"https://github.com/emicklei.png","language":"Go","readme":"# dgraph-access\n\n[![Build Status](https://travis-ci.org/emicklei/dgraph-access.png)](https://travis-ci.org/emicklei/dgraph-access)\n[![Go Report Card](https://goreportcard.com/badge/github.com/emicklei/dgraph-access)](https://goreportcard.com/report/github.com/emicklei/dgraph-access)\n[![GoDoc](https://godoc.org/github.com/emicklei/dgraph-access?status.svg)](https://pkg.go.dev/github.com/emicklei/dgraph-access?tab=doc)\n[![codecov](https://codecov.io/gh/emicklei/dgraph-access/branch/master/graph/badge.svg)](https://codecov.io/gh/emicklei/dgraph-access)\n\nThis is a helper package to work with `github.com/dgraph-io/dgo` (v2), a Go client for accessing a DGraph cluster.\nSee the examples folder for complete programs.\n\n## status\n\nThis package is under development (see commits); the API and scope may change before a v1.0.0 release.\n\n## motivation\n\nThis package was created to reduce the boilerplate code required to use the `raw` dgraph Go client.\n\n## features\n\n`dgraph-access` adds the following features to the standard Go client:\n\n- type UID and NQuad to create RDF triples w/o facets\n- type Node to encapsulate an uid and graph.type for your own entities\n- type DgraphAccess to handle transactions, JSON marshalling and populating entities\n- type Mutation to encapsulate a dgraph mutations that contains a list of RDF triples (NQuad values)\n- UpsertNode, CreateNode, CreateEdge, RunQuery, FindEquals model common dgraph operations\n- DgraphAccess can trace the queries, mutations and responses for debugging\n- DgraphAccess also provides a Service interface for convenient use of the operations\n\nThis repository also includes the [dggen tool](https://github.com/emicklei/dgraph-access/tree/master/cmd/dggen) that takes a dgraph schema to generate Go types from Dgraph types.\n\n## usage\n\n    import (\n        dga \"github.com/emicklei/dgraph-access\"\n    )\n\n## quick look\n\n    d := dga.NewDGraphAccess(yourDgraphClient).ForReadWrite()    \n    s := d.Service()\n    err := s.Alterschema(`name: string @index(exact) .`)\n    type Vegetable struct {\n        dga.Node `json:\",inline\" // this is for UID and Type propagation\n        Name string\n        Color string\n    }\n    v1 := \u0026Vegetable{Name:\"Carrot\"}\n    err = s.CreateNode(v1)\n\n    v2 := \u0026Vegetable{Name:\"Beet\"}\n    err = s.CreateEdge(v1,\"similarTo\",v2)\n\n    v3 := new(Vegetable)\n    err := s.FindEquals(v3,\"name\",\"Carrot\")    \n\n    v2.Color = \"darkred\"\n    s.UpsertNode(v2,\"name\",\"Beet\")\n\n## examples\n\nSee [examples](https://github.com/emicklei/dgraph-access/blob/master/examples).\n\nSee [documented code examples](https://godoc.org/github.com/emicklei/dgraph-access)\n\n© 2019+, [ernestmicklei.com](http://ernestmicklei.com).  MIT License. Contributions welcome.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fdgraph-access","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femicklei%2Fdgraph-access","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femicklei%2Fdgraph-access/lists"}