Explorar el Código

新增new context

dcsunny hace 4 años
padre
commit
981a6e09d8
Se han modificado 1 ficheros con 13 adiciones y 0 borrados
  1. 13 0
      common/context.go

+ 13 - 0
common/context.go

@@ -0,0 +1,13 @@
+package common
+
+import (
+	"context"
+
+	context2 "git.ikuban.com/server/kratos-utils/http/context"
+)
+
+func NewContext(userID int64) context.Context {
+	ctx := context.Background()
+	ctx = context2.AppendToContext(ctx, "user_id", userID)
+	return ctx
+}