-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: stop timer when processBatch trigger
- Loading branch information
Showing
5 changed files
with
108 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ jobs: | |
cache: true | ||
|
||
- name: Test | ||
run: go test -v ./... -coverprofile=coverage.out | ||
run: go test -race -v ./... -coverprofile=coverage.out | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
|
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
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,17 @@ | ||
package dataloader | ||
|
||
// Result is the result of a DataLoader operation | ||
type Result[V any] struct { | ||
data V | ||
err error | ||
} | ||
|
||
// Wrap wraps data and an error into a Result | ||
func Wrap[V any](data V, err error) Result[V] { | ||
return Result[V]{data: data, err: err} | ||
} | ||
|
||
// TryUnwrap returns the data or an error | ||
func (r Result[V]) Unwrap() (V, error) { | ||
return r.data, r.err | ||
} |