batch := roachpb.BatchRequest{} getReq := roachpb.GetRequest{} getReq.Key = roachpb.Key("some_key") batch.Add(&getReq)
batch := roachpb.BatchRequest{} txn := roachpb.MakeTransaction("txn_name", roachpb.Key("txn_key"), 0, roachpb.SERIALIZABLE, []roachpb.Key{}) getReq := roachpb.GetRequest{} getReq.Key = roachpb.Key("some_key") txn.Add(&getReq) batch.Add(&txn)These examples show how BatchRequest and Txn can be used together to create a batch of operations to be executed in a single transaction. This package library is a part of the CockroachDB Go client API, which provides a higher-level interface to interact with CockroachDB instances.