本文整理匯總了Golang中github.com/cockroachdb/cockroach/pkg/util/uuid.UUID.Short方法的典型用法代碼示例。如果您正苦於以下問題:Golang UUID.Short方法的具體用法?Golang UUID.Short怎麽用?Golang UUID.Short使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/pkg/util/uuid.UUID
的用法示例。
在下文中一共展示了UUID.Short方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: assertTS
// assertTS is a helper function for layeredIntervalTestCase
// validators. It queries the timestamp cache for the given keys and
// reports a test error if it doesn't match the given timestamp and
// transaction ID.
func assertTS(
t *testing.T,
tc *timestampCache,
start, end roachpb.Key,
expectedTS hlc.Timestamp,
expectedTxnID *uuid.UUID,
) {
var keys string
if len(end) == 0 {
keys = fmt.Sprintf("%q", start)
} else {
keys = fmt.Sprintf("%q-%q", start, end)
}
ts, txnID, _ := tc.GetMaxRead(start, end)
if !ts.Equal(expectedTS) {
t.Errorf("expected %s to have timestamp %v, found %v", keys, expectedTS, ts)
}
if expectedTxnID == nil {
if txnID != nil {
t.Errorf("expected %s to have no txn id, but found %s", keys, txnID.Short())
}
} else {
if txnID == nil {
t.Errorf("expected %s to have txn id %s, but found nil", keys, expectedTxnID.Short())
} else if *txnID != *expectedTxnID {
t.Errorf("expected %s to have txn id %s, but found %s",
keys, expectedTxnID.Short(), txnID.Short())
}
}
}