问题标签 [gqlgen]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
26 浏览

go - gqlgen Resolver func 在生成的代码中缺少 OrderBy 参数

我是新来的。我正在使用 gqlgen 和 ent 构建一个项目。我有 schema.graphql 定义如下

成功生成代码后,我看到 AppQueryResolver.Response 和 IP.queries 的函数在生成的代码中缺少after: Cursor, first: Int, before: Cursor, last: Int ...的参数。我已经根据示例项目审查了架构,但看不到可能导致此问题的原因。在代码生成过程中也没有错误。有关在何处进一步寻找解决此问题的任何指示

0 投票
0 回答
50 浏览

go - Go and Grapqhl setup not working on mac in documents folder

I was following this tutorial https://www.howtographql.com/graphql-go/1-getting-started/ and had a hard time getting it to work.

First, i tried all this in a subfolder of my Documents folder. However, after step go run github.com/99designs/gqlgen init only the schema was created.

However, if i execute the same steps in, e.g. a subfolder of Deskotp, everything gets created correctly.

Should be structure:

Structure if executed in sub folder of Documents:

Operating system: macOS Big Sur, 11.6 (MacBook Pro (16-inch, 2019)) Go version: go version go1.17.4 darwin/amd64

Can anyone help me out on why this does not work in the Documents sub tree?

Thanks a lot.

edit: As suggested go env

0 投票
2 回答
109 浏览

go - 如何使用 Gorm 解决 Graphql 联合?

我有两个具体类型ProdottoProdottoVariante的联合,它们都实现了Articolo类型的接口。

我想通过输入articoli来查询所有 Prodotto 和所有 ProdottoVariante但我不知道如何解决Articoli

我正在尝试这种方式:

我正在以这种方式查询:

但我收到此错误:

如何正确解决与 gorm 的工会?

0 投票
1 回答
52 浏览

json - 无法在 gqlgen 中生成标量 JSON

我有一个 GQL 方案:

在图形/模型/model.go 中:

但是当我运行 go run github.com/99designs/gqlgen 生成错误:

我只需要获取名为 JSON 的 map[string]interface{}。我知道有标量 Map,但对于阿波罗联邦,该字段必须称为 JSON。

0 投票
1 回答
30 浏览

go - Golang:生成核心失败:无法加载 github.com

我安装了 golang 并开始使用本教程:https ://www.howtographql.com/graphql-go/1-getting-started/

当我运行时:

我得到:

我的设置有什么问题?这是我的gopath