wip: basic feat

This commit is contained in:
loveuer
2024-03-22 18:05:47 +08:00
commit 983533237f
13 changed files with 327 additions and 0 deletions

17
internal/util/ctx.go Normal file
View File

@ -0,0 +1,17 @@
package util
import (
"context"
"time"
)
func Timeout(seconds ...int) context.Context {
second := 30
if len(seconds) > 0 && seconds[0] > 0 {
second = seconds[0]
}
ctx, _ := context.WithTimeout(context.Background(), time.Duration(second)*time.Second)
return ctx
}