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))
}

View File

@ -1,12 +0,0 @@
package tool
import "github.com/gin-gonic/gin"
func Local(c *gin.Context, key string) any {
data, ok := c.Get(key)
if !ok {
return nil
}
return data
}

View File

@ -2,7 +2,7 @@ package tool
import (
"context"
"gitea.loveuer.com/yizhisec/packages/logger"
"loveuer/utodo/pkg/logger"
"sync"
)

View File

@ -5,11 +5,12 @@ import (
"encoding/hex"
"errors"
"fmt"
"gitea.loveuer.com/yizhisec/packages/logger"
"golang.org/x/crypto/pbkdf2"
"loveuer/utodo/pkg/logger"
"regexp"
"strconv"
"strings"
"golang.org/x/crypto/pbkdf2"
)
const (

View File

@ -3,12 +3,13 @@ package tool
import (
"encoding/json"
"fmt"
"gitea.loveuer.com/yizhisec/packages/logger"
"github.com/jedib0t/go-pretty/v6/table"
"io"
"loveuer/utodo/pkg/logger"
"os"
"reflect"
"strings"
"github.com/jedib0t/go-pretty/v6/table"
)
func TablePrinter(data any, writers ...io.Writer) {