0.1.13 • Published 3 years ago

@anchan828/gen-order-schema v0.1.13

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@anchan828/gen-order-schema

Description

Generate order enum schema by directive

Quick Start

import { genOrderTypes } from "@anchan828/gen-order-schema"

const schema = `

type Test {
  id: ID
}

type Query {
  tests: [Test] @orderBy
}

`;

genOrderTypes(schema);
//=>  enum OrderDirection {
//      ASC
//      DESC
//    }
//    
//    type Query {
//      tests(orderBy: [TestOrder]): [Test]
//    }
//    
//    type Test {
//      id: ID
//    }
//    
//    type TestOrder {
//      sort: TestSort
//      direction: OrderDirection
//    }
//    
//    enum TestSort {
//      ID
//    }

Options

TODO

Supoprted Types

For now, supported types are Basic Types (String, Int, Float, Boolean, ID), and Enum

License

MIT.

0.1.13

3 years ago

0.1.12

3 years ago