Go 如何查询给定存储库中的提交(Lib:shurcooL/githubv4)
我正在尝试将此查询转换为结构:Go 如何查询给定存储库中的提交(Lib:shurcooL/githubv4),go,github,graphql,Go,Github,Graphql,我正在尝试将此查询转换为结构: { repository(owner: "google", name: "gson") { name refs(first: 100, refPrefix: "refs/heads/") { edges { node { name target { ... on Commit { id histor
{
repository(owner: "google", name: "gson") {
name
refs(first: 100, refPrefix: "refs/heads/") {
edges {
node {
name
target {
... on Commit {
id
history(first: 2) {
totalCount
edges {
node {
... on Commit {
committer {
date
email
name
}
}
}
}
}
}
}
}
}
}
}
}
这是我从你那里得到的
我在Github浏览器上测试了它,只是为了安全和正常工作。
我试图做的是获取每个参与者提交到特定存储库的“TotalCount”。
我真的不知道该怎么做。
我已经知道了:
type repositoryInfo struct {
Repository struct {
Refs struct {
TotalCount githubv4.Int //number of branches
Nodes []ref
PageInfo pageInfo
}`graphql:"refs(refPrefix:$prefix,first:$refFirst,after:$refAfter,orderBy:$orderBy)"`
} `graphql:"repository(owner:$login,name:$repositoryName)"`
}
type ref struct {
Name githubv4.String
Prefix githubv4.String
Target struct {
AbbreviatedOid githubv4.String
ID githubv4.GitObjectID
//History struct {
// TotalCount githubv4.Int
//}`graphql:"history(first:0)"`
}`graphql:"... on Commit"`
}
但我得到了这个错误信息:
Fragment on Commit can't be spread inside Ref
然而,我似乎找不到任何有用的文档。
谁能告诉我我做错了什么吗