Giter Club home page Giter Club logo

prisma-generator-garph's Introduction

prisma-generator-garph

Generate versatile garph schemes from your prisma schema.

This is still under development, expect bugs and breaks!

Currently does not support mongoDB composite types (https://www.prisma.io/docs/orm/prisma-schema/data-model/models#defining-composite-types)

Install it in your project,

npm i -D prisma-generator-garph
pnpm i -D prisma-generator-garph
bun i -D prisma-generator-garph

then add

generator garph {
  provider = "prisma-generator-garph"
  // you can optionally specify the output location. Defaults to ./garph
  output = "./myCoolGarphDirectory"
  // if you want, you can customize the imported variable name that is used for the schemes. Defaults to "g" which is what the standard garph package offers
  typeboxImportVariableName = "t"
  // you also can specify the dependency from which the above import should happen. This is useful if a package re-exports the typebox package and you would like to use that
  typeboxImportDependencyName = "garph"
}

to your prisma.schema. You can modify the settings to your liking, please see the respective comments for info on what the option does.

Annotations

prisma-generator-garph offers annotations to adjust the output of models and fields.

Annotation Example Description
@garph.hide - Hides the field or model from the output
@garph.hidden - Alias for @garph.hide

A schema using annotations could look like this:

/// The post model
model Post {
  id        Int      @id @default(autoincrement())
  /// @garph.hidden
  createdAt DateTime @default(now())
  title     String   @unique

  User   User? @relation(fields: [userId], references: [id])
  /// this is the user id
  userId Int?
}

/// @garph.hidden
enum Account {
  PASSKEY
  PASSWORD
}

Please note that you cannot use multiple annotations in one line! Each needs to be in its own!

prisma-generator-garph's People

Contributors

m1212e avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.