0.1.3 • Published 1 month ago

i-graphql v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

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",
  });
0.1.3

1 month ago

0.1.2

1 year ago

0.1.0

1 year ago

0.1.1

1 year ago

0.0.9

1 year ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago