graphql-go a union of scalars return type

152 Views Asked by At

i'm trying to make a filed that's either going to be a string or a date or an 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
        },
    },
})

i've tried to graphql.NewUnion but it doesn't seem to accept scalar types

0

There are 0 best solutions below