Categorygithub.com/ONSdigital/dp-graph
module
1.0.2
Repository: https://github.com/onsdigital/dp-graph.git
Documentation: pkg.go.dev

# README

dp-graph

A library to abstract graph database logic away from services

Configuration

Environment variableDefaultDescription
GRAPH_DRIVER_TYPE""string identifier for the implementation to be used (e.g. 'neo4j' or 'mock')
GRAPH_ADDR""address of the database matching the chosen driver type
GRAPH_POOL_SIZE0desired size of the connection pool
MAX_RETRIES0maximum number of attempts for transient query failures
GRAPH_QUERY_TIMEOUT0maximum number of seconds to allow a query before timing out

All config other than GRAPH_DRIVER_TYPE will be subject to that implementation to make use of and set reasonable defaults for use in that context. It's feasible that some implementations might not have configurable timeouts for example, so whether this can be set should be documented in each driver.

Design

See DESIGN for details.

Health package

The Graph checker function is currently implemented only for Neo4J. It connects to Neo4J and performs a 'ping query', just to validate that we can communicate with it. The health check will succeed only if the query succeeds.

Read the Health Check Specification for details.

Instantiate a Neo4J client

    cli := neo4jdriver.New(<dbAddr>, <size>, <timeout>)

Call Neo4J health checker with cli.Checker(context.Background()) and this will return a check object:

{
    "name": "string",
    "status": "string",
    "message": "string",
    "status_code": "int",
    "last_checked": "ISO8601 - UTC date time",
    "last_success": "ISO8601 - UTC date time",
    "last_failure": "ISO8601 - UTC date time"
}

Contributing

See CONTRIBUTING for details.

License

Copyright © 2019, Office for National Statistics (https://www.ons.gov.uk)

Released under MIT license, see LICENSE for details.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
This module, when combined with codelist.go, provides code that satisfies the graph.driver.CodeList interface using Gremlin queries into a Neptune database.
No description provided by the author