我可以将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 (将#修改为@)