New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dgql/client

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dgql/client

Translation engine and client for the DGQL Language

  • 1.1.0-alpha.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

@dgql/client

npm package

Translation engine and client for the DGQL Language.

Getting Started

$ npm install @dgql/client

Quick Start

const { Client } = require("@dgql/client");
const neo4j = require("neo4j-driver");

const driver = neo4j.driver(
  "bolt://localhost:7687",
  neo4j.auth.basic("neo4j", "password")
);

const client = new Client({ driver });

async function main() {
  const query = `
        {
            MATCH {
                user @node(label: User) {
                    WHERE {
                        name(equal: "Dan")
                    }
                    PROJECT {
                        name
                        posts @edge(type: HAS_POST, direction: OUT) @node(label: Post) {
                            title
                        }
                    }
                }
            }
            RETURN {
                user
            }
        }
    `;

  const { user } = await client.run({ query });

  console.log(user);
  /*
        [{
            name: "Dan",
            posts: [
                {
                    title: "Checkout @dgql/client"
                }
            ]
        }]
    */
}

main();

Usage

Variables

Use the $ symbol to use variables and provide variables map when calling translation or run;

const { user } = await client.run({ query, variables: { id: "user-id" } }); // OR
const translation = client.translate({ query, variables: { id: "user-id" } }); // OR
{
  MATCH {
    user @node(label: User) {
      WHERE {
        id(equal: $id)
      }
    }
  }
  RETURN {
    user
  }
}

Licence

MIT

Keywords

FAQs

Package last updated on 01 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc