我正在尝试创建一个文件,该文件将是字符串、日期或 int
var PredSearchElementType = graphql.NewObject(graphql.ObjectConfig{
Name: "PredSearchElementType",
Fields: graphql.Fields{
"_id": &graphql.Field{
Type: ObjectID,
},
"field_name": &graphql.Field{
Type: graphql.String,
},
"field_criteria": &graphql.Field{
Type: graphql.String,
},
"field_value": &graphql.Field{
Type: graphql.String,// this field can be a string or a date or an int
},
},
})
我试过,graphql.NewUnion
但它似乎不接受标量类型