GraphQLData
Backend-neutral presence model for the data entry of a GraphQL response.
GraphQLData distinguishes three wire states that a plain nullable field would conflate:
Absent: the response contains no
dataentry at all.Present with a non-null value: the response contains
datawith a value.Present with a null value: the response contains
data: null.
Usage
fun describe(data: GraphQLData<Viewer>) {
when (data) {
is GraphQLData.Absent -> println("no data entry")
is GraphQLData.Present -> {
val value: Viewer? = data.value
println(if (value == null) "data: null" else "data present")
}
}
}Content copied to clipboard
Type Parameters
T
The decoded type of the data entry.