无法执行”gqlgen generate”命令。

huangapple go评论69阅读模式
英文:

Cannnot do "gqlgen generate"

问题

首先,我初始化了 gqlgen。

go run github.com/99designs/gqlgen init

其次,我修复了 resolver.go 和 schema.resolvers.go 文件。
然后,我执行了以下命令,但是出现了错误。

$ go run github.com/99designs/gqlgen generate
reloading module info
modelgen: unable to find type: github.com/99designs/gqlgen/interfaces.Int
exit status 1

你知道问题出在哪里吗?

我没有预料到会出现什么问题。

英文:

First, I initialized gqlgen.

go run github.com/99designs/gqlgen init

Second, I fixed resolver.go and schema.resolvers.go
And, I execute this. Then error has occurred.

$ go run github.com/99designs/gqlgen generate
reloading module info
modelgen: unable to find type: github.com/99designs/gqlgen/interfaces.Int
exit status 1

Do you know what is problem?

I did not expect what is problem.

答案1

得分: 1

我将这段代码添加到gqlgen.yml中,问题解决了。

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
英文:

I add this to gqlgen.yml, problem is solved.

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

huangapple
  • 本文由 发表于 2023年2月4日 17:59:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75344305.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定