Define GraphQL inputs in Elm
Represents a JavaScript value.
Pass string argument into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asString", string "foo" )
]
GraphQL.Selector.intEquals to:
"""
fieldName(asString: "foo")
"""Pass int argument into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asInt", int 1 )
]
GraphQL.Selector.intEquals to:
"""
fieldName(asInt: 1)
"""Pass float argument into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asFloat", float 3.14 )
]
GraphQL.Selector.intEquals to:
"""
fieldName(asFloat: 3.14)
"""Pass bool argument into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asBool", bool True )
]
GraphQL.Selector.intEquals to:
"""
fieldName(asBool: true)
"""Pass null argument into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asNull", null )
]
GraphQL.Selector.intEquals to:
"""
fieldName(asNull: null)
"""Pass list of arguments into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asInConsistentList"
, list
[ string "foo"
, int 0
, list [ bool False ]
]
)
, ( "asConsistentList"
, list
[ int 0
, int 1
, int 2
]
)
]
GraphQL.Selector.intEquals to:
"""
fieldName(
asInConsistentList: ["foo", 0, false],
asConsistentList: [0, 1, 2]
)
"""Pass array of arguments into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asInConsistentArray"
, array
(Array.fromList
[ string "foo"
, int 0
, array [ bool False ]
]
)
)
, ( "asConsistentArray"
, array
(Array.fromList
[ int 0
, int 1
, int 2
]
)
)
]
GraphQL.Selector.intEquals to:
"""
fieldName(
asInConsistentList: ["foo", 0, false],
asConsistentList: [0, 1, 2]
)
"""Pass object of arguments into a graph.
GraphQL.Selector.succeed Constructor
|> GraphQL.Selector.field "fieldName"
[ ( "asObject"
, object
[ ( "asString", string "foo" )
, ( "asInt", int 1 )
, ( "asFloat", float 3.14 )
, ( "asBool", bool True )
, ( "asNull", null )
]
)
]
GraphQL.Selector.intEquals to:
"""
fieldName(asObject: {
asString: "foo",
asInt: 1,
asFloat: 3.14,
asBool: true,
asNull: null
})
"""Convert Argument into Value.
toValue (string "hello") == Json.Encode.string "hello"
toValue (bool True) == Json.Encode.bool True
toValue null == Json.Encode.null
toValue [ int 1, float 3.14 ] == Json.Encode.list [ Json.Encode.int 1, Json.Encode.float 3.14 ]
Represents a GraphQL input values.