补充注释

This commit is contained in:
2024-07-31 16:26:34 +08:00
parent c4bf456976
commit d1ea7c8b9b

View File

@@ -94,7 +94,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
schema, err := graphql.NewSchema(graphql.SchemaConfig{Query: graphql.NewObject(graphql.ObjectConfig{Name: "RootQuery", Fields: graphql.Fields{
"users": &graphql.Field{
Type: graphql.NewObject(graphql.ObjectConfig{
Name: "UserConnection",
Name: "UserConnection",
Description: "条件筛选用户列表",
Fields: graphql.Fields{
"list": &graphql.Field{Type: graphql.NewList(user), Description: "用户列表"},
"total": &graphql.Field{Type: graphql.Int, Description: "用户总数"},
@@ -168,7 +169,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
},
"images": &graphql.Field{
Type: graphql.NewObject(graphql.ObjectConfig{
Name: "ImageConnection",
Name: "ImageConnection",
Description: "条件筛选图像列表",
Fields: graphql.Fields{
"list": &graphql.Field{Type: graphql.NewList(image), Description: "图像列表"},
"total": &graphql.Field{Type: graphql.Int, Description: "图像总数"},
@@ -349,7 +351,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
},
"articles": &graphql.Field{
Type: graphql.NewObject(graphql.ObjectConfig{
Name: "ArticleConnection",
Name: "ArticleConnection",
Description: "条件筛选文章列表",
Fields: graphql.Fields{
"list": &graphql.Field{Type: graphql.NewList(article), Description: "文章列表"},
"total": &graphql.Field{Type: graphql.Int, Description: "文章总数"},
@@ -415,16 +418,18 @@ func NewSchema(config Config) (graphql.Schema, error) {
},
"tags": &graphql.Field{
Type: graphql.NewObject(graphql.ObjectConfig{
Name: "TagConnection",
Name: "TagConnection",
Description: "条件筛选标签列表",
Fields: graphql.Fields{
"list": &graphql.Field{Type: graphql.NewList(graphql.String)},
"total": &graphql.Field{Type: graphql.Int},
"list": &graphql.Field{Type: graphql.NewList(graphql.String), Description: "标签列表"},
"total": &graphql.Field{Type: graphql.Int, Description: "标签总数"},
},
}),
Args: graphql.FieldConfigArgument{
"first": &graphql.ArgumentConfig{Type: graphql.Int, DefaultValue: 10},
"after": &graphql.ArgumentConfig{Type: graphql.String, DefaultValue: "0"},
"before": &graphql.ArgumentConfig{Type: graphql.String},
"first": &graphql.ArgumentConfig{Type: graphql.Int, Description: "翻页参数(傳回清單中的前n個元素)"},
"last": &graphql.ArgumentConfig{Type: graphql.Int, Description: "翻页参数(傳回清單中的最後n個元素)"},
"after": &graphql.ArgumentConfig{Type: graphql.String, Description: "翻页参数(傳回清單中指定遊標之後的元素)"},
"before": &graphql.ArgumentConfig{Type: graphql.String, Description: "翻页参数(傳回清單中指定遊標之前的元素)"},
},
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
var tags []string