补充注释
This commit is contained in:
		
							
								
								
									
										128
									
								
								api/graphql.go
									
									
									
									
									
								
							
							
						
						
									
										128
									
								
								api/graphql.go
									
									
									
									
									
								
							@@ -32,11 +32,11 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
		Name:        "Article",
 | 
			
		||||
		Description: "文章信息",
 | 
			
		||||
		Fields: graphql.Fields{
 | 
			
		||||
			"id":          &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"title":       &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"tags":        &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"create_time": &graphql.Field{Type: graphql.DateTime},
 | 
			
		||||
			"update_time": &graphql.Field{Type: graphql.DateTime},
 | 
			
		||||
			"id":          &graphql.Field{Type: graphql.Int, Description: "文章ID"},
 | 
			
		||||
			"title":       &graphql.Field{Type: graphql.String, Description: "文章标题"},
 | 
			
		||||
			"tags":        &graphql.Field{Type: graphql.String, Description: "文章标签"},
 | 
			
		||||
			"create_time": &graphql.Field{Type: graphql.DateTime, Description: "文章创建时间"},
 | 
			
		||||
			"update_time": &graphql.Field{Type: graphql.DateTime, Description: "文章更新时间"},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
@@ -45,13 +45,13 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
		Name:        "User",
 | 
			
		||||
		Description: "用户信息",
 | 
			
		||||
		Fields: graphql.Fields{
 | 
			
		||||
			"id":          &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"user_name":   &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"avatar":      &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"rank":        &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"price":       &graphql.Field{Type: graphql.Float},
 | 
			
		||||
			"create_time": &graphql.Field{Type: graphql.DateTime},
 | 
			
		||||
			"update_time": &graphql.Field{Type: graphql.DateTime},
 | 
			
		||||
			"id":          &graphql.Field{Type: graphql.Int, Description: "用户ID"},
 | 
			
		||||
			"user_name":   &graphql.Field{Type: graphql.String, Description: "用户名"},
 | 
			
		||||
			"avatar":      &graphql.Field{Type: graphql.String, Description: "用户头像"},
 | 
			
		||||
			"rank":        &graphql.Field{Type: graphql.String, Description: "用户等级"},
 | 
			
		||||
			"price":       &graphql.Field{Type: graphql.Float, Description: "用户金币"},
 | 
			
		||||
			"create_time": &graphql.Field{Type: graphql.DateTime, Description: "用户创建时间"},
 | 
			
		||||
			"update_time": &graphql.Field{Type: graphql.DateTime, Description: "用户更新时间"},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
@@ -60,11 +60,9 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
		Name:        "Text",
 | 
			
		||||
		Description: "图像中的文字提取",
 | 
			
		||||
		Fields: graphql.Fields{
 | 
			
		||||
			"text":       &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"confidence": &graphql.Field{Type: graphql.Float},
 | 
			
		||||
			"coordinate": &graphql.Field{Type: &graphql.List{
 | 
			
		||||
				OfType: graphql.NewList(graphql.Float),
 | 
			
		||||
			}},
 | 
			
		||||
			"text":       &graphql.Field{Type: graphql.String, Description: "文字内容"},
 | 
			
		||||
			"confidence": &graphql.Field{Type: graphql.Float, Description: "置信度"},
 | 
			
		||||
			"coordinate": &graphql.Field{Type: &graphql.List{OfType: graphql.NewList(graphql.Float)}, Description: "文字坐标"},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
@@ -73,23 +71,23 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
		Name:        "Image",
 | 
			
		||||
		Description: "图像信息",
 | 
			
		||||
		Fields: graphql.Fields{
 | 
			
		||||
			"id":                      &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"width":                   &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"height":                  &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"content":                 &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"remark":                  &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"description":             &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"tags":                    &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"rank":                    &graphql.Field{Type: graphql.String},
 | 
			
		||||
			"text":                    &graphql.Field{Type: graphql.NewList(text)},
 | 
			
		||||
			"comment_num":             &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"article_category_top_id": &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"praise_count":            &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"collect_count":           &graphql.Field{Type: graphql.Int},
 | 
			
		||||
			"create_time":             &graphql.Field{Type: graphql.DateTime},
 | 
			
		||||
			"update_time":             &graphql.Field{Type: graphql.DateTime},
 | 
			
		||||
			"user":                    &graphql.Field{Type: user},
 | 
			
		||||
			"article":                 &graphql.Field{Type: article},
 | 
			
		||||
			"id":                      &graphql.Field{Type: graphql.Int, Description: "图像ID"},
 | 
			
		||||
			"width":                   &graphql.Field{Type: graphql.Int, Description: "图像宽度"},
 | 
			
		||||
			"height":                  &graphql.Field{Type: graphql.Int, Description: "图像高度"},
 | 
			
		||||
			"content":                 &graphql.Field{Type: graphql.String, Description: "图像内容"},
 | 
			
		||||
			"remark":                  &graphql.Field{Type: graphql.String, Description: "图像备注"},
 | 
			
		||||
			"description":             &graphql.Field{Type: graphql.String, Description: "图像描述"},
 | 
			
		||||
			"tags":                    &graphql.Field{Type: graphql.String, Description: "图像标签"},
 | 
			
		||||
			"rank":                    &graphql.Field{Type: graphql.String, Description: "图像等级"},
 | 
			
		||||
			"text":                    &graphql.Field{Type: graphql.NewList(text), Description: "图像中的文字"},
 | 
			
		||||
			"comment_num":             &graphql.Field{Type: graphql.Int, Description: "评论数"},
 | 
			
		||||
			"article_category_top_id": &graphql.Field{Type: graphql.Int, Description: "文章分类顶级ID"},
 | 
			
		||||
			"praise_count":            &graphql.Field{Type: graphql.Int, Description: "点赞数"},
 | 
			
		||||
			"collect_count":           &graphql.Field{Type: graphql.Int, Description: "收藏数"},
 | 
			
		||||
			"create_time":             &graphql.Field{Type: graphql.DateTime, Description: "图像创建时间"},
 | 
			
		||||
			"update_time":             &graphql.Field{Type: graphql.DateTime, Description: "图像更新时间"},
 | 
			
		||||
			"user":                    &graphql.Field{Type: user, Description: "图像所属用户"},
 | 
			
		||||
			"article":                 &graphql.Field{Type: article, Description: "图像所属文章"},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
@@ -98,20 +96,22 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
			Type: graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
				Name: "UserConnection",
 | 
			
		||||
				Fields: graphql.Fields{
 | 
			
		||||
					"list":  &graphql.Field{Type: graphql.NewList(user)},
 | 
			
		||||
					"total": &graphql.Field{Type: graphql.Int},
 | 
			
		||||
					"list":  &graphql.Field{Type: graphql.NewList(user), Description: "用户列表"},
 | 
			
		||||
					"total": &graphql.Field{Type: graphql.Int, Description: "用户总数"},
 | 
			
		||||
				},
 | 
			
		||||
			}),
 | 
			
		||||
			Args: graphql.FieldConfigArgument{
 | 
			
		||||
				"id":          &graphql.ArgumentConfig{Type: graphql.Int},
 | 
			
		||||
				"user_name":   &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"avatar":      &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"rank":        &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"create_time": &graphql.ArgumentConfig{Type: graphql.DateTime},
 | 
			
		||||
				"update_time": &graphql.ArgumentConfig{Type: graphql.DateTime},
 | 
			
		||||
				"text":        &graphql.ArgumentConfig{Type: graphql.String},                    // 查找图像中的文字
 | 
			
		||||
				"first":       &graphql.ArgumentConfig{Type: graphql.Int, DefaultValue: 10},     // 翻页参数
 | 
			
		||||
				"after":       &graphql.ArgumentConfig{Type: graphql.String, DefaultValue: "0"}, // 翻页参数
 | 
			
		||||
				"id":          &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选用户中指定ID的"},
 | 
			
		||||
				"user_name":   &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选用户中含有指定用户名的"},
 | 
			
		||||
				"avatar":      &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选用户中含有指定头像的"},
 | 
			
		||||
				"rank":        &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选用户中含有指定等级的"},
 | 
			
		||||
				"create_time": &graphql.ArgumentConfig{Type: graphql.DateTime, Description: "筛选用户中创建时间等于指定值的"},
 | 
			
		||||
				"update_time": &graphql.ArgumentConfig{Type: graphql.DateTime, Description: "筛选用户中更新时间等于指定值的"},
 | 
			
		||||
				"text":        &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定文字的"},
 | 
			
		||||
				"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 fields []string
 | 
			
		||||
@@ -170,27 +170,27 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
			Type: graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
				Name: "ImageConnection",
 | 
			
		||||
				Fields: graphql.Fields{
 | 
			
		||||
					"list":  &graphql.Field{Type: graphql.NewList(image)},
 | 
			
		||||
					"total": &graphql.Field{Type: graphql.Int},
 | 
			
		||||
					"list":  &graphql.Field{Type: graphql.NewList(image), Description: "图像列表"},
 | 
			
		||||
					"total": &graphql.Field{Type: graphql.Int, Description: "图像总数"},
 | 
			
		||||
				},
 | 
			
		||||
			}),
 | 
			
		||||
			Args: graphql.FieldConfigArgument{
 | 
			
		||||
				"id":            &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定ID的"},
 | 
			
		||||
				"width":         &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定宽度的"},
 | 
			
		||||
				"height":        &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定高度的"},
 | 
			
		||||
				"content":       &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"remark":        &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"description":   &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"tags":          &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"rank":          &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"content":       &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定内容的"},
 | 
			
		||||
				"remark":        &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定备注的"},
 | 
			
		||||
				"description":   &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定描述的"},
 | 
			
		||||
				"tags":          &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定标签的"},
 | 
			
		||||
				"rank":          &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定等级的"},
 | 
			
		||||
				"text":          &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定文字的"},
 | 
			
		||||
				"comment_num":   &graphql.ArgumentConfig{Type: graphql.Int},
 | 
			
		||||
				"praise_count":  &graphql.ArgumentConfig{Type: graphql.Int},
 | 
			
		||||
				"collect_count": &graphql.ArgumentConfig{Type: graphql.Int},
 | 
			
		||||
				"comment_num":   &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中评论数等于指定值的"},
 | 
			
		||||
				"praise_count":  &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中点赞数等于指定值的"},
 | 
			
		||||
				"collect_count": &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中收藏数等于指定值的"},
 | 
			
		||||
				"article_id":    &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中属于指定文章ID的"},
 | 
			
		||||
				"user_id":       &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中属于指定用户ID的"},
 | 
			
		||||
				"create_time":   &graphql.ArgumentConfig{Type: graphql.DateTime},
 | 
			
		||||
				"update_time":   &graphql.ArgumentConfig{Type: graphql.DateTime},
 | 
			
		||||
				"create_time":   &graphql.ArgumentConfig{Type: graphql.DateTime, Description: "筛选图像中创建时间等于指定值的"},
 | 
			
		||||
				"update_time":   &graphql.ArgumentConfig{Type: graphql.DateTime, Description: "筛选图像中更新时间等于指定值的"},
 | 
			
		||||
				"first":         &graphql.ArgumentConfig{Type: graphql.Int, Description: "翻页参数(傳回清單中的前n個元素)"},
 | 
			
		||||
				"last":          &graphql.ArgumentConfig{Type: graphql.Int, Description: "翻页参数(傳回清單中的最後n個元素)"},
 | 
			
		||||
				"after":         &graphql.ArgumentConfig{Type: graphql.String, Description: "翻页参数(傳回清單中指定遊標之後的元素)"},
 | 
			
		||||
@@ -351,16 +351,16 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
			Type: graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
				Name: "ArticleConnection",
 | 
			
		||||
				Fields: graphql.Fields{
 | 
			
		||||
					"list":  &graphql.Field{Type: graphql.NewList(article)},
 | 
			
		||||
					"total": &graphql.Field{Type: graphql.Int},
 | 
			
		||||
					"list":  &graphql.Field{Type: graphql.NewList(article), Description: "文章列表"},
 | 
			
		||||
					"total": &graphql.Field{Type: graphql.Int, Description: "文章总数"},
 | 
			
		||||
				},
 | 
			
		||||
			}),
 | 
			
		||||
			Args: graphql.FieldConfigArgument{
 | 
			
		||||
				"id":          &graphql.ArgumentConfig{Type: graphql.Int},
 | 
			
		||||
				"title":       &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"tags":        &graphql.ArgumentConfig{Type: graphql.String},
 | 
			
		||||
				"create_time": &graphql.ArgumentConfig{Type: graphql.DateTime},
 | 
			
		||||
				"update_time": &graphql.ArgumentConfig{Type: graphql.DateTime},
 | 
			
		||||
				"id":          &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选文章中指定ID的"},
 | 
			
		||||
				"title":       &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选文章中含有指定标题的"},
 | 
			
		||||
				"tags":        &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选文章中含有指定标签的"},
 | 
			
		||||
				"create_time": &graphql.ArgumentConfig{Type: graphql.DateTime, Description: "筛选文章中创建时间等于指定值的"},
 | 
			
		||||
				"update_time": &graphql.ArgumentConfig{Type: graphql.DateTime, Description: "筛选文章中更新时间等于指定值的"},
 | 
			
		||||
			},
 | 
			
		||||
			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
 | 
			
		||||
				var fields []string
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user