-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from theplant/totalcount
refactor
- Loading branch information
Showing
16 changed files
with
669 additions
and
647 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,36 @@ | ||
package relay | ||
|
||
import "context" | ||
|
||
type ctxKeySkipTotalCount struct{} | ||
|
||
func WithSkipTotalCount(ctx context.Context) context.Context { | ||
return context.WithValue(ctx, ctxKeySkipTotalCount{}, true) | ||
} | ||
|
||
func ShouldSkipTotalCount(ctx context.Context) bool { | ||
b, _ := ctx.Value(ctxKeySkipTotalCount{}).(bool) | ||
return b | ||
} | ||
|
||
type ctxKeySkipEdges struct{} | ||
|
||
func WithSkipEdges(ctx context.Context) context.Context { | ||
return context.WithValue(ctx, ctxKeySkipEdges{}, true) | ||
} | ||
|
||
func ShouldSkipEdges(ctx context.Context) bool { | ||
b, _ := ctx.Value(ctxKeySkipEdges{}).(bool) | ||
return b | ||
} | ||
|
||
type ctxKeySkipNodes struct{} | ||
|
||
func WithSkipNodes(ctx context.Context) context.Context { | ||
return context.WithValue(ctx, ctxKeySkipNodes{}, true) | ||
} | ||
|
||
func ShouldSkipNodes(ctx context.Context) bool { | ||
b, _ := ctx.Value(ctxKeySkipNodes{}).(bool) | ||
return b | ||
} |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.