# neo4j-func

> Wrapper for neo4j tu use it in a functionnal way

Latest version **1.2.4** (published 2020-04-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install neo4j-func
pnpm add neo4j-func
yarn add neo4j-func
bun add neo4j-func
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2020-04-06 |
| First published | 2020-04-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 95.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Milihhard |
| Maintainers | milihhard |
| Keywords | neo4j, typescript |

## Links

- npm: https://www.npmjs.com/package/neo4j-func
- Repository: https://github.com/Milihhard/neo4j-func
- Homepage: https://github.com/Milihhard/neo4j-func#readme
- Issues: https://github.com/Milihhard/neo4j-func/issues
- npm.io page: https://npm.io/package/neo4j-func

## Dependencies (6)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.13.1
- [neo4j-driver](https://npm.io/package/neo4j-driver.md) ^4.0.0
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.149
- [@types/js-yaml](https://npm.io/package/@types/js-yaml.md) ^3.12.3
- [guid-typescript](https://npm.io/package/guid-typescript.md) ^1.0.9

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.2.4 (latest) — 2020-04-06
- 1.2.3 — 2020-04-06
- 1.2.2 — 2020-04-06
- 1.2.1 — 2020-04-06
- 1.2.0 — 2020-04-06
- 1.1.9 — 2020-04-06
- 1.1.7 — 2020-04-06
- 1.0.12 — 2020-04-03
- 1.0.11 — 2020-04-02
- 1.0.10 — 2020-04-02
- 1.0.9 — 2020-04-02
- 1.0.8 — 2020-04-02
- 1.0.7 — 2020-04-02
- 1.0.6 — 2020-04-02
- 1.0.5 — 2020-04-02
- … 5 more at https://npm.io/package/neo4j-func/versions

## README

# neo4j-func

[![Coverage Status](https://coveralls.io/repos/github/Milihhard/neo4j-func/badge.svg?branch=master)](https://coveralls.io/github/Milihhard/neo4j-func?branch=master) ![Testing app](https://github.com/Milihhard/neo4j-func/workflows/Testing%20app/badge.svg) ![Building](https://github.com/Milihhard/neo4j-func/workflows/Building/badge.svg) ![Publish to npm](https://github.com/Milihhard/neo4j-func/workflows/Publish%20to%20npm/badge.svg)

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

## Installation

```bash
$npm install neo4j-func
```

or

```bash
$yarn add neo4j-func
```

## Usage

### define the config file

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

### define your nodes and links

For a node :

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

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

For a link :

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

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

### run you command

```typescript
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

---
_Source: https://npm.io/package/neo4j-func · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
