We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6f9725 commit b1e4553Copy full SHA for b1e4553
1 file changed
context.go
@@ -37,3 +37,8 @@ func Cancelable() (C, Cancel) {
37
func WithCancel(c C) (C, Cancel) {
38
return context.WithCancel(c)
39
}
40
+
41
+// WithTTL wraps an existing Context that will expire after the given duration.
42
+func WithTTL(c C, duration time.Duration) (C, Cancel) {
43
+ return context.WithTimeout(c, duration)
44
+}
0 commit comments