Skip to content

Commit 607a971

Browse files
authored
add AbortReason to transaction response (#96)
* add AbortStatus to transaction response * add abort reason test
1 parent fdbe579 commit 607a971

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

rai/client_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -943,3 +943,11 @@ func TestListEdb(t *testing.T) {
943943
assert.NotNil(t, rsp)
944944
}
945945
}
946+
947+
func TestTransactionAbort(t *testing.T) {
948+
query := `ic test_ic { false }`
949+
950+
rsp, err := test.client.Execute(test.databaseName, test.engineName, query, nil, true, o11yTag)
951+
assert.Nil(t, err)
952+
assert.Equal(t, "integrity constraint violation", rsp.Transaction.AbortReason)
953+
}

rai/models.go

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ type Transaction struct {
158158
Database string `json:"database_name,omitempty"`
159159
Query string `json:"query,omitempty"`
160160
State TransactionState `json:"state"`
161+
AbortReason string `json:"abort_reason,omitempty"`
161162
ReadOnly bool `json:"read_only,omitempty"`
162163
CreatedBy string `json:"created_by,omitempty"`
163164
CreatedOn int64 `json:"created_on,omitempty"`

0 commit comments

Comments
 (0)