Skip to content

ubgo/gqlmodel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gqlmodel GitHub license

Gqlmodel custom models for gqlgen.com grqphql module.

Installation

go get github.com/ubgo/gqlmodel

Note: If you are getting error modelgen: unable to find type github.com/ubgo/gqlmodel.UidScalar then create a new go file or use existing go file and add below code

import _ github.com/ubgo/gqlmodel

Models Support

  • uuid.UUID

How to Use

  1. Edit the gqlgen.yml file and add the code like this under models
Uid:
  model: github.com/ubgo/gqlmodel.UidScalar
  1. Under your schema.graphqls file add this scalar Uid
  2. Now you can use the UUID like this:
type Category {
  id: Uid!
  name: String!
}

You will see the model file generated as following:

type Category struct {
  ID   uuid.UUID `json:"id"`
  Name string    `json:"name"`
}

Contribute

If you would like to contribute to the project, please fork it and send us a pull request. Please add tests for any new features or bug fixes.

Stay in touch

License

goutil is MIT licensed.

Packages

No packages published

Languages