vitess.io/vitess@v0.16.2/go/vt/vttablet/tabletmanager/vreplication/queryhistory/doc.go (about)

     1  // Package queryhistory provides tools for verifying that a SQL statement
     2  // history conforms to a set of expectations.
     3  //
     4  // For example...
     5  //
     6  //	expectations := Expect("delete1", "insert1").
     7  //	    Then(func(sequence ExpectationSequence) ExpectationSequence {
     8  //	        c1 := sequence.Then(Eventually("insert2")).
     9  //	                       Then(Eventually("update1"))
    10  //	        c2 := sequence.Then(Eventually("insert3")).
    11  //	                       Then(Eventually("update2"))
    12  //	        c1.Then(c2.Eventually())
    13  //	        return c2
    14  //	    }).
    15  //	    Then(Immediately("delete2")
    16  //
    17  // ...creates a sequence of expectations, such that:
    18  //
    19  //   - "delete1" is expected first,
    20  //   - "insert1" immediately follows "delete1",
    21  //   - "insert2" and "insert3" eventually follow "insert1", in any order,
    22  //   - "update1" eventually follows "insert2"
    23  //   - "update2" eventually follows "insert3"
    24  //   - "update2" eventually follows "update1"
    25  //   - "delete2" immediately follows "update2"
    26  //
    27  // To verify a sequence of expectations, construct a verifier...
    28  //
    29  //	verifier := NewVerifier(expectations)
    30  //
    31  // ...and make successive calls with actual queries:
    32  //
    33  //	result := verifier.AcceptQuery("insert1")
    34  //
    35  // If the verifier accepts a query, it modifies its internal state in order to
    36  // verify sequenced expectations (e.g. that "q2" eventually follows "q1").
    37  package queryhistory