இவை மூன்று operation type-கள், ஒவ்வொன்றும் schema-வில் ஒரு root type-க்கு map செய்யப்படுகிறது:
இவை மூன்று operation type-கள், ஒவ்வொன்றும் schema-வில் ஒரு root type-க்கு map செய்யப்படுகிறது:
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
}
}
Mutation-கள் argument-களை (பெரும்பாலும் ஒரு input object) எடுத்துக்கொள்கின்றன, மேலும் client இரண்டாவது request இல்லாமல் refresh செய்யக்கூடியவாறு பாதிக்கப்பட்ட data-வைத் திருப்பி அனுப்ப வேண்டும். Sequential விதி முக்கியம்: ஒரே document-இல் இரண்டு mutation-கள் — deposit பிறகு withdraw — எப்போதும் அந்த வரிசையிலேயே இயங்கும், அதேசமயம் இரண்டு query fields ஒரே நேரத்தில் resolve ஆகக்கூடும்.
Query-கள் parallel மற்றும் side-effect-free, mutation-கள் sequential என்பதையும், ஒரு subscription-க்கு stateful transport (WebSocket/SSE) தேவை என்பதையும் நீங்கள் அறிவீர்களா என்பதை interviewer-கள் சரிபார்க்கிறார்கள். ஒரு mutation-லிருந்து updated data-வைத் திருப்பி அனுப்புவது, GraphQL-ஐ உண்மையில் ship செய்தவர்களை வெறும் புத்தகத்தில் படித்தவர்களிடமிருந்து பிரிக்கும் நடைமுறை விவரம் ஆகும்.
விரிவான பதில்களுடன் கூடிய IT நேர்காணல் கேள்விகளின் நூலகம் — Junior முதல் Senior வரை.
நன்கொடை