This commit is contained in:
loveuer
2025-07-14 10:48:21 +08:00
parent b48fa05d9f
commit 13ca43ee28
25 changed files with 830 additions and 125 deletions

View File

@ -2,8 +2,6 @@ package tool
import (
"context"
"fmt"
"gitea.loveuer.com/yizhisec/packages/opt"
"time"
)
@ -23,7 +21,7 @@ func Timeout(seconds ...int) (ctx context.Context) {
return
}
func CtxTimeout(ctx context.Context, seconds ...int) context.Context {
func TimeoutCtx(ctx context.Context, seconds ...int) context.Context {
var (
duration time.Duration
)
@ -38,7 +36,3 @@ func CtxTimeout(ctx context.Context, seconds ...int) context.Context {
return nctx
}
func CtxTrace(ctx context.Context, key string) context.Context {
return context.WithValue(ctx, opt.TraceKey, fmt.Sprintf("%36s", key))
}