From b2620422447bb56fb8366ec47d1188456decd6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Thu, 15 Sep 2022 16:14:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(global):=E5=85=A8=E5=B1=80=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E4=B8=AA=E7=94=A8=E4=BA=8E=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=B8=A6=E6=9C=89=E8=B6=85=E6=97=B6=E6=8E=A7=E5=88=B6=E7=9A=84?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=96=87=E7=94=9F=E6=88=90=E5=99=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- global/context.go | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 global/context.go diff --git a/global/context.go b/global/context.go new file mode 100644 index 0000000..7545f40 --- /dev/null +++ b/global/context.go @@ -0,0 +1,10 @@ +package global + +import ( + "context" + "time" +) + +func TimeoutContext(timeout time.Duration) (context.Context, context.CancelFunc) { + return context.WithTimeout(context.Background(), timeout) +}