1.0.28 • Published 4 years ago

@iammhc/neo4j-nest v1.0.28

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Neo4j for NestJS

codecov npm Actions Status GitHub Snyk Vulnerabilities for GitHub Repo GitHub package.json dependency version (prod)

Neo4j driver for Nest Framework.

What's New GitHub release (latest by date)

Installation

$ npm i --save @iammhc/nestjs-neo4j

or

$ yarn add @iammhc/nestjs-neo4j

Usage

import { Neo4jModule, Neo4jModuleConfig } from '@iammhc/nestjs-neo4j';

Configuration

    imports: [
      Neo4jModule.forRoot({
          host: 'localhost',
          password: '',
          port: 34498,
          scheme: 'bolt',
          username: 'neo4j',
        }),
    ],

Async Configuration

When you need to set Neo4jModule options asynchronously instead of statically, use the forRootAsync() method. As with most dynamic modules, Nest provides several techniques to deal with async configuration.

One technique is to use a factory function:

Like other factory providers, our factory function can be async and can inject dependencies through inject.

    imports: [
      Neo4jModule.forRootAsync({
        imports: [ConfigModule],
        inject: [ConfigService],
        useFactory: (configService: ConfigService): Neo4jModuleConfig => ({
          host: configService.get('NEO4J_HOST'),
          password: configService.get('NEO4J_PASSWORD'),
          port: configService.get('NEO4J_PORT'),
          scheme: configService.get('NEO4J_SCHEME'),
          username: configService.get('NEO4J_USERNAME'),
        }),
      }),
    ],

Usage examples

  import { Neo4jService } from '@iammhc/nestjs-neo4j';

  constructor(private readonly neo4jService: Neo4jService) {}

  example():Neo4jModuleConfig {
    return this.neo4jService.getConfig();
  }
functionDescriptionArgument
getConfigConfig Detail of neo4jNone
getDriverNeo4j DriverNone
getReadSessionGet Read Session of Neo4jgetReadSession('database?')
getWriteSessionGet Write Session of Neo4jgetWriteSession('database?')
readUse for Read Dataread('cypher','params','database?')
writeUse for write Datawrite('cypher','params','database?')

Stay in touch

GitHub followers Twitter Follow

License

Package is MIT licensed.

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.19

4 years ago

1.0.20

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago