如何解决我可以将graphql模式转换为Go结构以映射响应对象吗?
是否有任何自动工具可将由枚举,类型和联合组成的graphQL模式转换为Go结构?我尝试使用https://transform.tools/之类的一些在线工具将响应转换为Go结构,但是由于没有一个包含所有结果的响应,因此映射变得越来越困难。
type GradingReport {
report_date: String!
report_date_iso: String!
report_number: String!
report_type: String!
report_type_code: ReportTypeCode!
results: ReportResults
# Links to other files,such as images and PDFs.
links: Links
# Quota remaining after this report is returned.
quota: Quota
info_message: String
# If report is part of digital program.
is_digital: Boolean
# If report data has been issued as an in-progress grading report. A PDF version
# is not available at this time.
is_sleeve: Boolean
}
到
type GradingReport struct {
reportDate string `json:"report_date"`
reportDateIso string `json:"report_date_iso"`
reportNumber string `json:"report_number"`
reportType string `json:"report_type"`
reportTypeCode ReportTypeCode `json:"report_type_code"`
results ReportResults `json:"results"`
// # Links to other files,such as images and PDFs.
links Links `json:"links"`
// # Quota remaining after this report is returned.
quota Quota `json:"quota"`
// # Any special information regarding your report request,for example if your
// # original requested report has been updated to a different report number.
infoMessage string `json:"info_message"`
// # If report is part of digital program.
isDigital bool `json:"is_digital"`
// # If report data has been issued as an in-progress grading report. A PDF version
// # is not available at this time.
isSleeve bool `json:"is_sleeve"`
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。