合并字段
This commit is contained in:
		@@ -101,10 +101,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
		log.Fatalln("连接数据库失败", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var user, article, text *graphql.Object
 | 
			
		||||
 | 
			
		||||
	// 用户的可选字段
 | 
			
		||||
	user = graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
	user := graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
		Name:        "User",
 | 
			
		||||
		Description: "用户信息",
 | 
			
		||||
		Fields: graphql.Fields{
 | 
			
		||||
@@ -119,7 +117,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	// 文章的可选字段
 | 
			
		||||
	article = graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
	article := graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
		Name:        "Article",
 | 
			
		||||
		Description: "文章",
 | 
			
		||||
		Fields: graphql.Fields{
 | 
			
		||||
@@ -151,18 +149,6 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
			"article_num": &graphql.Field{Type: graphql.Int, Description: "分类文章数量"},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
	fmt.Println(category)
 | 
			
		||||
 | 
			
		||||
	// 图像中的文字提取
 | 
			
		||||
	text = graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
		Name:        "Text",
 | 
			
		||||
		Description: "图像中的文字提取",
 | 
			
		||||
		Fields: graphql.Fields{
 | 
			
		||||
			"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: "文字坐标"},
 | 
			
		||||
		},
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	// 图像的可选字段
 | 
			
		||||
	image := graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
@@ -185,7 +171,15 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
			
		||||
			"update_time":             &graphql.Field{Type: graphql.DateTime, Description: "图像更新时间"},
 | 
			
		||||
			"article":                 &graphql.Field{Type: article, Description: "图像所属文章"},
 | 
			
		||||
			"text": &graphql.Field{
 | 
			
		||||
				Type:        graphql.NewList(text),
 | 
			
		||||
				Type: graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
					Name:        "Text",
 | 
			
		||||
					Description: "图像中的文字提取",
 | 
			
		||||
					Fields: graphql.Fields{
 | 
			
		||||
						"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: "文字坐标"},
 | 
			
		||||
					},
 | 
			
		||||
				})),
 | 
			
		||||
				Description: "图像中的文字",
 | 
			
		||||
				Args: graphql.FieldConfigArgument{
 | 
			
		||||
					"text": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选含有指定文字的列"},
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user