Skip to content

Commit

Permalink
add AbortReason to transaction response (#96)
Browse files Browse the repository at this point in the history
* add AbortStatus to transaction response

* add abort reason test
  • Loading branch information
rsulli-rai authored Aug 21, 2023
1 parent fdbe579 commit 607a971
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rai/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,3 +943,11 @@ func TestListEdb(t *testing.T) {
assert.NotNil(t, rsp)
}
}

func TestTransactionAbort(t *testing.T) {
query := `ic test_ic { false }`

rsp, err := test.client.Execute(test.databaseName, test.engineName, query, nil, true, o11yTag)
assert.Nil(t, err)
assert.Equal(t, "integrity constraint violation", rsp.Transaction.AbortReason)
}
1 change: 1 addition & 0 deletions rai/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ type Transaction struct {
Database string `json:"database_name,omitempty"`
Query string `json:"query,omitempty"`
State TransactionState `json:"state"`
AbortReason string `json:"abort_reason,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedOn int64 `json:"created_on,omitempty"`
Expand Down

0 comments on commit 607a971

Please sign in to comment.