Skip to content

Commit

Permalink
type alias for errand options (#11)
Browse files Browse the repository at this point in the history
* type alias for errand options

* add comment for linter
  • Loading branch information
mmoghaddam385 authored Aug 6, 2021
1 parent 80529c3 commit 778b9b3
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 106 deletions.
22 changes: 13 additions & 9 deletions schemas/errand.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,10 @@ var ErrandStatuses = []Status{StatusBlocked, StatusInactive, StatusActive, Statu
type Errand struct {

// General Attributes:
ID string `json:"id"`
Name string `json:"name" binding:"required"`
Type string `json:"type" binding:"required"`
Options struct {
TTL int `json:"ttl,omitempty"`
Retries int `json:"retries,omitempty"`
Priority int `json:"priority,omitempty"`
DeleteOnCompleted bool `json:"deleteOnCompleted,omitempty"`
} `json:"options"`
ID string `json:"id"`
Name string `json:"name" binding:"required"`
Type string `json:"type" binding:"required"`
Options ErrandOptions `json:"options"`
Data map[string]interface{} `json:"data,omitempty"`
Created int64 `json:"created"`
Status Status `json:"status,omitempty"`
Expand All @@ -53,6 +48,15 @@ type Errand struct {
PipelineID string `json:"pipeline,omitempty"`
}

// ErrandOptions holds various options tied to an errand.
//easyjson:json
type ErrandOptions struct {
TTL int `json:"ttl,omitempty"`
Retries int `json:"retries,omitempty"`
Priority int `json:"priority,omitempty"`
DeleteOnCompleted bool `json:"deleteOnCompleted,omitempty"`
}

//easyjson:json
type Log struct {
Severity string `json:"severity" binding:"required"`
Expand Down
208 changes: 111 additions & 97 deletions schemas/schemas_easyjson.go

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

0 comments on commit 778b9b3

Please sign in to comment.