1.2.4 • Published 4 years ago

neo4j-func v1.2.4

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

neo4j-func

Coverage Status Testing app Building Publish to npm

neo4j-func is a neo4j wrapper for node.js
It helps making queries by using a functional approach

Installation

$npm install neo4j-func

or

$yarn add neo4j-func

Usage

define the config file

# neo4j.yaml
host: 0.0.0.0
port: 7687
credentials:
    user: neo4j
    password: neo4j

define your nodes and links

For a node :

@node('MyNode')
class MyNode extends NodeNeo4J {
    @property()
    @notNull
    mandatoryProperty: PropertyDefinition<string>;
    @property()
    property2: PropertyDefinition<string>;

    constructor(mandatoryProperty?: string, property2?: string) {
        super();
    }
}

For a link :

@node('MyLink')
class MyLink extends LinkNeo4J {
    @property()
    @notNull
    mandatoryProperty: PropertyDefinition<string>;
    @property()
    property2: PropertyDefinition<string>;

    constructor(mandatoryProperty?: string, property2?: string) {
        super();
    }
}

run you command

const myNode = new MyNode('mandatory', 'optionnal');
new Neo4jCommand()
    .match(myNode)
    .where(ID(myNode))
    .equals(myNode.value(myNode.property2))
    .returnValue(node)
    .run()
    .then((result) =>
        result.records[0].map((record) => {
            if (result.records.length > 0) {
                return result.records[0].MyNode as MyNode;
            } else {
                return null;
            }
        })
    );

.run return a promise

1.2.4

4 years ago

1.2.3

4 years ago

1.2.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.9

4 years ago

1.1.7

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago