Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Use Go 1.19.4
- Add `IsExternalStorageError` to check for [external storage errors](https://www.arangodb.com/docs/stable/appendix-error-codes.html#external-arangodb-storage-errors)
- `nested` field in arangosearch type View
- Fix: TTL index creation fails when expireAt is 0

## [1.4.1](https://github.com/arangodb/go-driver/tree/v1.4.1) (2022-12-14)
- Add support for `checksum` in Collections
Expand Down
2 changes: 1 addition & 1 deletion collection_indexes_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type indexData struct {
Estimates *bool `json:"estimates,omitempty"`
MaxNumCoverCells int `json:"maxNumCoverCells,omitempty"`
MinLength int `json:"minLength,omitempty"`
ExpireAfter int `json:"expireAfter,omitempty"`
ExpireAfter int `json:"expireAfter"`
Name string `json:"name,omitempty"`
FieldValueTypes string `json:"fieldValueTypes,omitempty"`
IsNewlyCreated *bool `json:"isNewlyCreated,omitempty"`
Expand Down
15 changes: 15 additions & 0 deletions test/index_ensure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,21 @@ func TestEnsureTTLIndex(t *testing.T) {
} else if found {
t.Errorf("Index '%s' does exist, expected it not to exist", idx.Name())
}

// Create index with expireAfter = 0
idx, created, err = col.EnsureTTLIndex(nil, "createdAt", 0, nil)
if err != nil {
t.Fatalf("Failed to create new index: %s", describe(err))
}
if !created {
t.Error("Expected created to be true, got false")
}
if idxType := idx.Type(); idxType != driver.TTLIndex {
t.Errorf("Expected TTLIndex, found `%s`", idxType)
}
if idx.ExpireAfter() != 0 {
t.Errorf("Expected ExpireAfter to be 0, found `%d`", idx.ExpireAfter())
}
}

// TestEnsureZKDIndex creates a collection with a ZKD index.
Expand Down