forked from Shyp/rickover
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also start working on passing around a *newmodels.Queries instead of hardcoding `*newmodels.DB` everywhere. Add a new `responses` package that can help us get rid of `auto_id` in the database response, which is something that we don't want to expose. Updates #8.
- Loading branch information
1 parent
d876623
commit 7e19f8e
Showing
11 changed files
with
171 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dbtohttp | ||
|
||
import ( | ||
"github.com/kevinburke/rickover/newmodels" | ||
"github.com/kevinburke/rickover/responses" | ||
) | ||
|
||
func Job(j newmodels.Job) responses.Job { | ||
return responses.Job{ | ||
Name: j.Name, | ||
DeliveryStrategy: string(j.DeliveryStrategy), | ||
Attempts: j.Attempts, | ||
Concurrency: j.Concurrency, | ||
CreatedAt: j.CreatedAt, | ||
} | ||
} | ||
|
||
func Jobs(js []newmodels.Job) []responses.Job { | ||
resp := make([]responses.Job, len(js)) | ||
for i := range js { | ||
resp[i] = Job(js[i]) | ||
} | ||
return resp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package responses | ||
|
||
import "time" | ||
|
||
type Job struct { | ||
Name string `json:"name"` | ||
DeliveryStrategy string `json:"delivery_strategy"` | ||
Attempts int16 `json:"attempts"` | ||
Concurrency int16 `json:"concurrency"` | ||
CreatedAt time.Time `json:"created_at"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.