Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the dump status to an enum #243

Merged
merged 1 commit into from
Nov 23, 2021
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
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ func TestClient_GetDumpStatus(t *testing.T) {
tests := []struct {
name string
client *Client
wantResp []string
wantResp []DumpStatus
wantErr bool
}{
{
name: "TestGetDumpStatus",
client: defaultClient,
wantResp: []string{"in_progress", "failed", "done"},
wantResp: []DumpStatus{DumpStatusInProgress, DumpStatusFailed, DumpStatusDone},
wantErr: false,
},
}
Expand Down
20 changes: 16 additions & 4 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,26 @@ type Keys struct {
Private string `json:"private,omitempty"`
}

// DumpStatus is the status of a dump.
type DumpStatus string

const (
// DumpStatusInProgress means the server is processing the dump
DumpStatusInProgress DumpStatus = "in_progress"
// DumpStatusFailed means the server failed to create a dump
DumpStatusFailed DumpStatus = "failed"
// DumpStatusDone means the server completed the dump
DumpStatusDone DumpStatus = "done"
)

// Dump indicate information about an dump
//
// Documentation: https://docs.meilisearch.com/reference/api/dump.html
type Dump struct {
UID string `json:"uid"`
Status string `json:"status"`
StartedAt time.Time `json:"startedAt"`
FinishedAt time.Time `json:"finishedAt"`
UID string `json:"uid"`
Status DumpStatus `json:"status"`
StartedAt time.Time `json:"startedAt"`
FinishedAt time.Time `json:"finishedAt"`
}

//
Expand Down
2 changes: 1 addition & 1 deletion types_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.