Iku telu operation type, saben dipetakan menyang siji root type ing schema:
Iku telu operation type, saben dipetakan menyang siji root type ing schema:
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 nampa argumen (kerep awujud object input) lan kudune mbalekake data sing kena pengaruh supaya klien bisa nyegerake tanpa request kaping pindho. Aturan runtut iku penting: rong mutation ing siji dokumen — deposit banjur withdraw — mesthi mlaku ing urutan kuwi, dene rong field query bisa uga diresolve bebarengan.
Pewawancara ngecek apa kowe ngerti yen query iku paralel lan tanpa efek samping dene mutation iku runtut, lan yen subscription mbutuhake transport sing stateful (WebSocket/SSE). Mbalekake data sing wis diupdate saka mutation iku rincian praktis sing mbedakake wong sing wis tau ngirim GraphQL karo wong sing mung maca babagan iku.
Pustaka pitakon wawancara IT kanthi jawaban rinci — saka Junior nganti Senior.
Nyumbang