The Command Incantation
Encapsulating a request as a standalone object.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Evocation // Execution
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
# The Command object encapsulating all parameters for an action
input TeleportCommand {
destinationCoords: [Float!]!
passengerCount: Int!
useLeyLines: Boolean! = true
}
type TeleportResult {
success: Boolean!
energyExpended: Int!
}
type Mutation {
# Executing the Command
executeTeleport(command: TeleportCommand!): TeleportResult!
}
Every GraphQL mutation is essentially an implementation of the Command pattern. By encapsulating all the parameters of an action into a single Input object (the command), the Oracle can queue, log, or even reverse the magical operations systematically.
Runic Tags:
#graphql
#behavioral
#command
#mutations
#inputs