ఇవి మూడు operation types, ప్రతి ఒక్కటి schema లో ఒక root type కు mapped:
ఇవి మూడు operation types, ప్రతి ఒక్కటి schema లో ఒక root type కు mapped:
query GetPost { # read
post(id: "1") { title }
}
mutation AddComment { # write; returns the created object so the client updates its cache
addComment(postId: "1", text: "Nice!") {
id
text
}
}
subscription OnComment { # live: fires every time a comment is added
commentAdded(postId: "1") {
id
text
}
}
Mutations arguments ను తీసుకుంటాయి (తరచుగా ఒక input object) మరియు client రెండవ request లేకుండా refresh చేయగలిగేలా ప్రభావిత data ను తిరిగి ఇవ్వాలి. Sequential rule ముఖ్యం: ఒకే document లో రెండు mutations — deposit తర్వాత withdraw — ఎల్లప్పుడూ ఆ క్రమంలోనే నడుస్తాయి, కానీ రెండు query fields ఏకకాలంలో resolve కావచ్చు.
Queries parallel మరియు side-effect-free గా ఉంటాయి, mutations sequential గా ఉంటాయి అని మీకు తెలుసా, మరియు subscription కు stateful transport (WebSocket/SSE) అవసరమని తెలుసా అని interviewers తనిఖీ చేస్తారు. Mutation నుండి updated data ను తిరిగి ఇవ్వడం అనేది GraphQL ను నిజంగా ship చేసిన వారిని కేవలం చదివిన వారి నుండి వేరు చేసే ఆచరణాత్మక వివరం.
జూనియర్ నుండి సీనియర్ వరకు వివరణాత్మక సమాధానాలతో IT ఇంటర్వ్యూ ప్రశ్నల లైబ్రరీ.
విరాళం