# graphql-guru-sequelize

> Sequelize database resolver modules for GraphQL Guru

Latest version **0.0.1** (published 2017-08-12) · 0 weekly downloads

## Install

```sh
npm install graphql-guru-sequelize
pnpm add graphql-guru-sequelize
yarn add graphql-guru-sequelize
bun add graphql-guru-sequelize
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-08-12 |
| First published | 2017-08-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 25 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | otissv |
| Keywords | graphql, graphql.guru, graphql-guru, guru, resolvers, sequelize, sql, PostgreSQL, MySQL, SQLite, MSSQL, database |

## Links

- npm: https://www.npmjs.com/package/graphql-guru-sequelize
- npm.io page: https://npm.io/package/graphql-guru-sequelize

## Dependencies (25)

- [pg](https://npm.io/package/pg.md) ^7.1.0
- [ava](https://npm.io/package/ava.md) ^0.21.0
- [watch](https://npm.io/package/watch.md) ^1.0.2
- [eslint](https://npm.io/package/eslint.md) ^4.3.0
- [mysql2](https://npm.io/package/mysql2.md) ^1.4.0
- [sqlite3](https://npm.io/package/sqlite3.md) ^3.1.9
- [tedious](https://npm.io/package/tedious.md) ^2.0.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0
- [babel-cli](https://npm.io/package/babel-cli.md) ^6.24.1
- [pg-hstore](https://npm.io/package/pg-hstore.md) ^2.3.2
- [pluralize](https://npm.io/package/pluralize.md) ^6.0.0
- [sequelize](https://npm.io/package/sequelize.md) ^4.4.2
- [babel-eslint](https://npm.io/package/babel-eslint.md) ^7.2.2
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.23.0
- [class-autobind](https://npm.io/package/class-autobind.md) ^0.1.4
- [eslint-plugin-node](https://npm.io/package/eslint-plugin-node.md) ^5.1.1
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.24.1
- [babel-preset-stage-3](https://npm.io/package/babel-preset-stage-3.md) ^6.24.1
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.2.0
- [eslint-plugin-graphql](https://npm.io/package/eslint-plugin-graphql.md) ^1.3.0
- [eslint-plugin-promise](https://npm.io/package/eslint-plugin-promise.md) ^3.5.0
- [eslint-config-standard](https://npm.io/package/eslint-config-standard.md) ^10.2.1
- [eslint-plugin-standard](https://npm.io/package/eslint-plugin-standard.md) ^3.0.1
- [@graphql-guru/babel-tasks](https://npm.io/package/@graphql-guru/babel-tasks.md) ^1.0.2
- [babel-plugin-transform-async-to-generator](https://npm.io/package/babel-plugin-transform-async-to-generator.md) ^6.24.1

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2017-08-12

## README

# GraphQL Guru Sequelize
Sequelize database resolver modules for GraphQL Guru.

It supports the dialects PostgreSQL, MySQL, SQLite and MSSQL 

## Installation
1) In a terminal run `npm install graphql-guru-sequelize`

2) In environment.js add the path to the json storage file and optionally add defaults to seed the database on creation.

    server/environment.js
```
    database: {
      sequelize: {
        username: 'username',
        databases: 'database',
        port: '5432',
        dialect: 'sqlite', // one of 'mysql'|'sqlite'|'postgres'|'mssql',
        host: 'localhost',
        pool: {
          max: 5,
          min: 0,
          idle: 10000
        }
      },
      // SQLite only
      storage: 'path/to/sqlite/database'
    }
```

3) In index-database.js import graphql-guru-sequelize and add it to the database object.

    server/core/database/index-database.js
```
    import * as sequelize from 'graphql-guru-sequelize';

    export const databases = {
      sequelize
    };

```

4) extend resolverQuery and resolverMutation with SequelizeQuery and SequelizeMutation respectively.

    server/modules/resolverQuery.js
    ```
    import { SequelizeQuery } from 'graphql-guru-sequelize';

    export default class People extends SequelizeQuery {
    }
    ```

    server/modules/resolverMutation.js
    ```
    import { SequelizeMutation } from 'graphql-guru-sequelize';

    export default class People extends SequelizeMutation {
    }
    ```
5) Add the methods to your schema files

server/modules/schemaQuery.js
```
peopleResolve(id: String): People
peopleFindAll(id: String): [People]
peopleFindById(id: String): People
peopleFindManyById(id: [String]): [People]
```

server/modules/schemaMutation.js
```
# Add description
peopleCreate(
  firstName: String,
  lastName:  String
): People

# Add description
peopleRemove (
  id: String
): People

# Add description
peopleUpdate(
  id:        String,
  firstName: String,
  lastName:  String
): People
```

# Usage
Once all the installation steps are complete you're go to go.

You can overwrite the methods with your own or add new methods inside the resolvers.

# Database methods
For database usage see [sequelizejs.com]http://docs.sequelizejs.com/

# License
MIT

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