Neo4j client for Golang

Related tags


neoism - Neo4j client for Go

Neoism Logo

Package neoism is a Go client library providing access to the Neo4j graph database via its REST API.


System Status
Travis CI Travis CI
CircleCI CircleCI
Coveralls Coveralls
Codecov Codecov

This driver is fairly complete, and may now be suitable for general use. The code has an extensive set of integration tests, but little real-world testing. YMMV; use in production at your own risk.


Go 1.1 or later is required.

Tested against Neo4j 2.2.4 and Go 1.4.1.



go get -v


Neoism is versioned using

Current release is v1

go get


See GoDoc or Go Walker for automatically generated documentation.


Connect to Neo4j Database

db, err := neoism.Connect("http://localhost:7474/db/data")

Create a Node

n, err := db.CreateNode(neoism.Props{"name": "Captain Kirk"})

Issue a Cypher Query

// res will be populated with the query results.  It must be a slice of structs.
res := []struct {
		// `json:` tags matches column names in query
		A   string `json:""` 
		Rel string `json:"type(r)"`
		B   string `json:""`

// cq holds the Cypher query itself (required), any parameters it may have 
// (optional), and a pointer to a result object (optional).
cq := neoism.CypherQuery{
	// Use backticks for long statements - Cypher is whitespace indifferent
	Statement: `
		MATCH (a:Person)-[r]->(b)
		WHERE = {name}
		RETURN, type(r),
	Parameters: neoism.Props{"name": "Dr McCoy"},
	Result:     &res,

// Issue the query.
err := db.Cypher(&cq)

// Get the first result.
r := res[0]

Issue Cypher queries with a transaction

tx, err := db.Begin(qs)
if err != nil {
  // Handle error

cq0 := neoism.CypherQuery{
  Statement: `MATCH (a:Account) WHERE a.uuid = {account_id} SET balance = balance + {amount}`,
  Parameters: neoism.Props{"uuid": "abc123", amount: 20},
err = db.Cypher(&cq0)
if err != nil {
  // Handle error

cq1 := neoism.CypherQuery{
  Statement: `MATCH (a:Account) WHERE a.uuid = {account_id} SET balance = balance + {amount}`,
  Parameters: neoism.Props{"uuid": "def456", amount: -20},
err = db.Cypher(&cq1)
if err != nil {
  // Handle error

err := tx.Commit()
if err != nil {
  // Handle error



  • Node (create/edit/relate/delete/properties)
  • Relationship (create/edit/delete/properties)
  • Legacy Indexing (create/edit/delete/add node/remove node/find/query)
  • Cypher queries
  • Batched Cypher queries
  • Transactional endpoint (Neo4j 2.0)
  • Node labels (Neo4j 2.0)
  • Schema index (Neo4j 2.0)
  • Authentication (Neo4j 2.2)

To Do:

  • Streaming API support - see Issue #22
  • Unique Indexes - probably will not expand support for legacy indexing.
  • Automatic Indexes - "
  • High Availability
  • Traversals - May never be supported due to security concerns. From the manual: "The Traversal REST Endpoint executes arbitrary Groovy code under the hood as part of the evaluators definitions. In hosted and open environments, this can constitute a security risk."
  • Built-In Graph Algorithms
  • Gremlin


Neoism's test suite respects, but does not require, a NEO4J_URL environment variable. By default it assumes Neo4j is running on localhost:7474, with username neo4j and password foobar.

export NEO4J_URL=http://your_user:[email protected]/db/data/
go test -v .

If you are using a fresh untouched Neo4j instance, you can use the included script to set the password to that expected by Neoism's tests:



Support and consulting services are available from Silicon Beach Heavy Industries.


Contributions in the form of Pull Requests are gladly accepted. Before submitting a PR, please ensure your code passes all tests, and that your changes do not decrease test coverage. I.e. if you add new features also add corresponding new tests.


This is Free Software, released under the terms of the GPL v3.

  • Can't connect to GrapheneDB

    Can't connect to GrapheneDB

    Hello there,

    When I try to connect to Graphene DB I get the following output :

    14:40:14.646490 database.go:55: Status 200 trying to connect to http://app****:****@app***
    panic: Invalid database.  Check URI.

    I think it comes from the style of the url.


    opened by azr 18
  • Blog post / driver listing?

    Blog post / driver listing?

    Hey @jmcvetta do you have a blog post about this driver somwhere? Would it make sense to add it to ? Where do you currently use it? Thanks !

    opened by jexp 10
  • Embedded props

    Embedded props

    Hello there,

    Correct me if I'm wrong but it seems to me that embedded props is something not possible at the moment.

    params := neoism.Props{
        "movieProps": neoism.Props{
            "title": "The Matrix",

    I could help doing it if you'd like !


    opened by azr 10
  • Examples needed.

    Examples needed.

    Currently the only example code for new users of neoism is embedded in the Go package docs:

    It would be nice to split that out into an actual example program. Not sure if there is a way to have the contents of a .go file included in the automatic package docs, or if this will have to be copypasta.

    opened by jmcvetta 9
  • Transactional endpoint

    Transactional endpoint

    Support new transactional endpoint feature in Neo4j 2.0.

    opened by jmcvetta 8
  • Batch support

    Batch support

    Thinking about how to implement batch operations. Afaik the REST API allows any standard call to be included in a batch operation. A not-yet-existing node can be referred to by its batch ID number. It looks like the batch ID syntax ({ 2 } refers to the result of batch item 2) gets replaced in subsequent commands by the self URL of the previously created entity. Not sure how well this will work for all operations.

    For instance, we can probably add a newly created node to an index by supplying the batch ID syntax in the uri field of the POST. But how can we delete that same index later in the batch, since the actual node ID is required to compose the URL for the DELETE request?

    Should batch support be added to existing Node and Relationship objects? That approach means that some methods, when used in a batch, will always return errors. Maybe it is better to have separate TxNode and TxRelationship objects with a limited subset of methods?[email protected]/msg14045.html

    The py2neo driver lets you do index removes in a batch, but they can only refer to a pre-existing node:

    opened by jmcvetta 7
  • Cypher collection results don't work

    Cypher collection results don't work

    I'll try to submit a patch... this is my query:

    match n:Run-[:scores]->scores
    return n.version, n.released, collect(scores)

    The last column is throwing an error.

    opened by freeeve 7
  • Add a PropertyKeys() method

    Add a PropertyKeys() method

    It would be great to have the possibility to fetch all property types like it is mentioned in

    opened by n5i 7
  • repo name conflicts with neo4j itself

    repo name conflicts with neo4j itself

    I know it's probably overly annoying to change it now, but the name is the same as neo4j itself, which is maybe only annoying to people like me who have forked both. If you ever have reason to rename it... please take this into consideration. :)

    Feel free to close this issue.

    opened by freeeve 7
  • Fix For Napping API Change

    Fix For Napping API Change

    Fix for issue #80

    opened by thdxr 6
  • Removing test.XXX Flags (Closing #94) when importing this library

    Removing test.XXX Flags (Closing #94) when importing this library

    Hi :) this PR closes issue nr #94 . It simply removes the testing dependencies from the doc.go document.

    Before go1.2rc2 this would be necessary in order to get them with go get. However testing depencies can be gathered using the -t flag.


    opened by c-f 1
  •  #94 - Rename benchmark_test_* files

    #94 - Rename benchmark_test_* files

    Importing the testing package in a file, which is used by the main binary, will pollute the flags package with testing help usage messages. This hinders the usage of the neoism package in a cli application. The file benchmark_test*.go are loading the testing package and are therefore responsible for the flag pollution. To exclude the benchmark_connect helpers one can suffix the files with _test. This will ensure that the benchmark_connect helpers are only loaded during testing and do not pollute the main binary. Another solution would be to introduce a neoism_test package, which would result a massive code reorganization.

    opened by co0p 1
  • Permit custom http client

    Permit custom http client

    This PR borrows from #97 in that it allows users of this library to supply their own http.Client instance, but utilises a functional option style of configuration meaning we can leave the Connect method unchanged for the default case, but permit a custom client to be passed via a variadic second argument.

    Our reason for requiring this was to use the HTTPS connector with a self signed certificate where we required creating a custom client with the same certificate in order to communicate from our client to the server.

    This PR also tweaked a couple of lines of Cypher in order to have the tests pass on Neo4j 3.2.x .

    opened by smulube 1
  • Create a node with label and properties

    Create a node with label and properties

    I can't add a node with label and property. I only add node with properties and then add label. But if add label fail, I must delete this node. So ID node Increased rapidly. I think that we need a func to add node with label

    opened by kienbui1995 3
  • Receiving nested resutls

    Receiving nested resutls

    I have a problem with transferring a response from Neo4j to Golang using neoism.

    The Neo4j response has nested structure and is assembled with Neo4j plugin in the following way.

    I can see that the response is correct in the Neo4j panel. The problem appears when I'm trying to get the response with Golang.

    The following error is received: "Unsupported property type: class pkgName.Dev$NestedReport"

    The problem isn't reproduced in case if only one top-level element is present in the results.

    What is the best way to resolve the issue?

    opened by n5i 2
  • Allow the caller to supply their own http client.

    Allow the caller to supply their own http client.

    This is useful for example if the caller wants to supply their own http client with a custom transport (in my case, one that connects via a socks5 proxy)

    opened by mjgarton 2
  • get rid of the flags in build version

    get rid of the flags in build version

    Importing "testing" in files whose name doesn't end _test.go will cause a lot of flags in those go program which have both imported "flag" and "".

    Here is the example:

    package main
    import (
    func main() {
        if file, err := os.Open("."); err != nil {
        } else {
            dir, err := file.Readdir(-1)
            if err != nil {
            for _, fi := range dir {
        db, _ := neoism.Connect("http://neo4j:[email protected]:7474/db/data")
    > ./test
    Usage of ./test:
      -httptest.serve string
            if non-empty, httptest.NewServer serves on this address and blocks
      -test.bench string
            regular expression to select benchmarks to run
            print memory allocations for benchmarks
      -test.benchtime duration
            approximate run time for each benchmark (default 1s)
      -test.blockprofile string
            write a goroutine blocking profile to the named file after execution
      -test.blockprofilerate int
            if >= 0, calls runtime.SetBlockProfileRate() (default 1)
      -test.count n
            run tests and benchmarks n times (default 1)

    And I got the "httptest.serve" left even if I removed all the test.go files in neoism. This is really annoying, so I hope it will be fixed soon. Thanks for your effort.

    ArkBriar 2016-4-29

    opened by arkbriar 1
  • Null Pointer Exception

    Null Pointer Exception

    websites, _ := DB.NodesByLabel("Website") for _, website := range websites { stmt := MATCH (webpage:Webpage)-[]->(website:Website{website:{website}}) RETURN webpage; address, _ := website.Property("address") params := neoism.Props{"website": address}

        // query results
        res := []struct {
            Webpage neoism.Node `json:"webpage"`
        // construct query
        cq := neoism.CypherQuery{
            Statement:  stmt,
            Parameters: params,
            Result:     &res,
        // execute query
        err := DB.Cypher(&cq)
        fmt.Println(err, res[0].Webpage.Id())  

    Here err is nil but res[0].Webpage is typeof Node and still have not Id() method and Data present in this object.

    opened by akshaykumar12527 2
  • Added support for https connections

    Added support for https connections

    Added support for https connections with either skipping the cert check or passing the cert file in an env variable.

    This is especially useful as from neo4j 2.2 as the default is to run over https.

    Unfortunately the Go https implementation does not accept the neo4j cert file that is automatically generated during the neo4j installation so you still have to create a key and cert file manually.

    opened by tolomaus 4
Jason McVetta
Jason McVetta
Neo4j Rest API Client for Go lang

neo4j.go Implementation of client package for communication with Neo4j Rest API. For more information and documentation please read Godoc Neo4j Page s

Cihangir 26 Aug 28, 2020
Neo4j REST Client in golang

DEPRECATED! Consider these instead: Install: If you don't ha

null 76 Aug 28, 2020
Go Redis Client

xredis Built on top of with the idea to simplify creating a Redis client, provide type safe calls and encapsulate the low l

Raed Shomali 15 Jun 2, 2021
Aerospike Client Go

Aerospike Go Client An Aerospike library for Go. This library is compatible with Go 1.9+ and supports the following operating systems: Linux, Mac OS X

Aerospike 365 Jun 3, 2021
Distributed WebSocket broker

dSock dSock is a distributed WebSocket broker (in Go, using Redis). Clients can authenticate & connect, and you can send text/binary message as an API

Charles Crete 198 Apr 13, 2021
A pure go library to handle MySQL network protocol and replication.

A pure go library to handle MySQL network protocol and replication.

null 3.1k Jun 21, 2021
Golang client for redislabs' ReJSON module with support for multilple redis clients (redigo, go-redis)

Go-ReJSON - a golang client for ReJSON (a JSON data type for Redis) Go-ReJSON is a Go client for ReJSON Redis Module. ReJSON is a Redis module that im

Nitish Malhotra 167 Jun 9, 2021
Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes

Develop, Deploy and Secure Serverless Apps on Kubernetes. Website • Docs • Support Space Cloud is a Kubernetes based serverless platform that provides

Space Up Technologies 3k Jun 11, 2021
Go client library for Pilosa

Go Client for Pilosa Go client for Pilosa high performance distributed index. What's New? See: CHANGELOG Requirements Go 1.12 and higher. Install Down

Pilosa 46 Jun 13, 2021
Simple key-value store abstraction and implementations for Go (Redis, Consul, etcd, bbolt, BadgerDB, LevelDB, Memcached, DynamoDB, S3, PostgreSQL, MongoDB, CockroachDB and many more)

gokv Simple key-value store abstraction and implementations for Go Contents Features Simple interface Implementations Value types Marshal formats Road

Philipp Gillé 343 Jun 15, 2021
Mongo Go Models (mgm) is a fast and simple MongoDB ODM for Go (based on official Mongo Go Driver)

Mongo Go Models Important Note: We changed package name from Kamva) to kamva) in v

kamva 313 Jun 13, 2021
Type-safe Redis client for Golang

Redis client for Golang ❤️ - distributed traces, logs, and errors in one place Join Discord to ask questions. Documentation Reference Exam

null 11.7k Jun 13, 2021
Type-safe Redis client for Golang

Redis client for Golang ❤️ - distributed traces, logs, and errors in one place Join Discord to ask questions. Documentation Reference Exam

null 11.7k Jun 13, 2021
The Go driver for MongoDB

MongoDB Go Driver The MongoDB supported driver for Go. Requirements Installation Usage Bugs / Feature Reporting Testing / Development Continuous Integ

mongodb 5.8k Jun 13, 2021