Skip to content

How do I generate multiple models? #3634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
root9464 opened this issue Apr 3, 2025 · 1 comment
Open

How do I generate multiple models? #3634

root9464 opened this issue Apr 3, 2025 · 1 comment

Comments

@root9464
Copy link

root9464 commented Apr 3, 2025

I read in the documentation that it is possible to generate multiple generated files.go for each module (for example), but there is not a word about how you can generate models for each module in this way.

I have a task: there are 2 modules
/modules/test/model
/modules/test2/model
after code generation, I want to have my own model in each of these directories based on the gql schema.

screen my filesctruct

Image

my gqlgen.yml

schema:
  - modules/*/gql/schema.gql

exec:
  filename: packages/generated/generated.go
  package: generated

model:
  filename: packages/generated/models_gen.go
  package: generated

resolver:
  layout: follow-schema
  dir: modules
  package: gql

autobind:
  - github.com/root9464/Go_GamlerDefi/modules/test/model
  - github.com/root9464/Go_GamlerDefi/modules/test_user/model

models:
  ID:
    model:
      - github.com/99designs/gqlgen/graphql.ID
      - github.com/99designs/gqlgen/graphql.Int
      - github.com/99designs/gqlgen/graphql.Int64
      - github.com/99designs/gqlgen/graphql.Int32
  Int:
    model:
      - github.com/99designs/gqlgen/graphql.Int
      - github.com/99designs/gqlgen/graphql.Int64
      - github.com/99designs/gqlgen/graphql.Int32

@root9464
Copy link
Author

root9464 commented Apr 3, 2025

ps: filename: modules/{module}/model/models_gen.go dont workinig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant