How to do it...

These steps cover writing and running your application:

  1. From your terminal/console application, create the chapter11/graphql directory and navigate to it.
  2. Copy tests from https://github.com/agtorre/go-cookbook/tree/master/chapter11/graphql or use this as an exercise to write some of your own.
  3. Create and navigate to the cards directory.
  4. Create a file called card.go with the following content:
        package cards        // Card represents a standard playing        // card        type Card struct {            Value string            Suit string        }        var cards []Card        func init() {            cards = []Card{                {"A", "Spades"}, {"2", "Spades"}, {"3", "Spades"},                {"4", "Spades"}, {"5", "Spades"}, {"6", "Spades"},                {"7", "Spades"}, {"8", "Spades"}, {"9", "Spades"}, {"10", "Spades"}, {"J", "Spades"}, ...

Get Go Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.