Not sure how to use this... docs?

I spent about an hour trying to find docs for DGraph, but couldn’t find anything beyond some sample curl requests.
Are there any docs for this?
Is there a golang API/library?

I’d like to give this project a shot with golang for a point-of-sale program I wrote in PHP that was too slow (~500ms load times) using MySQL. I just found out about graph databases, which seem to fit my use-case, but I can’t actually find any documentation on how to implement a graph database in golang and I’ve looked at more than a few (I feel like I’ve looked at all of them).
Any push in the right direction would be appreciated.

1 Like

Hey @nanohard

Glad to hear that you want to try out Dgraph. We are working on improving documentation for Dgraph. We do have a Go client using which you can run basic queries and mutations on the Dgraph server. We use GraphQL as the query language though support for features of GraphQL is limited right now.

We are working on improving the documentation on our Wiki at http://wiki.dgraph.io/

2 Likes

Could some more examples of inserts (mutations?) be added to the wiki?
Can’t figure out how to set fields of an object.

For example:
How would I insert Alice and set Alice’s birthday, lastName, and gender?

Also, when trying to start the server after there are existing files in dgraph/m, dgraph/p, and dgraph/u using:
dgraph --mutations dgraph/m --postings dgraph/p --uids dgraph/u
I get the error:
flag provided but not defined: -mutations

Is there another command to start the server after the first time? The above command to start the server is all I found in the wiki, so I thought it would work every time on the same data. But I have to recompile the dgraph binary to get it to work after I stop and want to start the server again.

Did you try these:
https://wiki.dgraph.io/index.php?title=Beginners'_guide#Queries_and_Mutations

The mutations are using rdf nquad format.

1 Like

Yeah, staring at that for 2 hours didn’t help. And I can’t find any examples online. It seems like only very smart people could interpret the writings I’ve found on “RDF”, which I’m not.

Hmm… I will take a stab at docs for queries and mutations today.

@nanohard This is strange and should not be happening.What does dgraph --help output for you?

When I set a mutation then stop the server then start the server I get this (this is also the output of dgraph --help, minus that first line about the -mutations flag):

flag provided but not defined: -mutations Usage of dgraph: -ip string Port to communicate with server (default "127.0.0.1:8081") -query string Query sent to the server (default "mutation { set {<alice> <follows> <bob> . <alice> <name>Alice. <bob> <name>Bob. }}")

When I recompile the output of dgraph --help is:

Usage of dgraph: -instanceIdx uint serves only entities whose Fingerprint % numInstance == instanceIdx. -mutations string Directory to store mutations -nomutations Don't allow mutations on this server. -numCpu int Number of cores to be used by the process (default 2) -port int Port to run server on. (default 8080) -postings string Directory to store posting lists -stw_ram_mb uint If RAM usage exceeds this, we stop the world, and flush our buffers. (default 4096) -trace float The ratio of queries to trace. (default 0.5) -uids string XID UID posting lists directory -workerport string Port used by worker for internal communication. (default ":12345") -workers string Comma separated list of IP addresses of workers

@nanohard -

Those are the help instructions of Dgraph Go client. And of course mutations flag isn’t available for the go client. Somehow you are getting confused between the Go client and the Dgraph server.

My guess is that you have cloned the Dgraph go client within a folder named dgraph and hence your Go client example binary is also called dgraph. Is this the case?

1 Like

Ah, it might be because my client uses the folder name dgraph. Thanks.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.