Skip to content

GraphQL Friendly ORM for MongoDB and GraphQL Zeus - right now in alpha stage

Notifications You must be signed in to change notification settings

graphql-editor/i-graphql

Repository files navigation

iGraphQL

ORM for dbs and GraphQL. The mission is to make graphql zeus typings database friendly. This is an alpha version and supports mongodb only.

Installation

npm i -D graphql-zeus
npm i i-graphql mongodb

Generation

$ npx zeus https://example.com/graphql ./src

Now when you generated your types you can use them inside project

Example

src/orm.ts

import { ModelTypes } from "./zeus";
import { iGraphQL } from "i-graphql";

export const orm = async () => {
  return iGraphQL<
    Pick<ModelTypes, "Operation" | "Invoice" | "Source">,
    {
      _id: () => string;
      createdAt: () => string;
      updatedAt: () => string;
    }
  >({
    _id: () => new ObjectId().toHexString(),
    createdAt: () => new Date().toISOString(),
    updatedAt: () => new Date().toISOString(),
  });
};

export const MongOrb = await orm();

How to use your orm

const resolver = () =>
  MongOrb("Source").createWithAutoFields(
    "_id",
    "createdAt"
  )({
    name: "My Source",
  });

About

GraphQL Friendly ORM for MongoDB and GraphQL Zeus - right now in alpha stage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published