feat: add protobuf message compression and decompression for Redis; refactor product fetching logic

This commit is contained in:
2025-08-17 06:16:15 +03:00
parent 38acc4a443
commit abbcc0a81a
1396 changed files with 609 additions and 451436 deletions

View File

@@ -3,6 +3,7 @@ package utils
import (
"encoding/json"
"fmt"
"github.com/golang-jwt/jwt/v5"
)
@@ -30,3 +31,21 @@ func DecodeWildberriesJwt(token []byte) (WbAuthData, jwt.MapClaims, error) {
return authData, claims, nil
}
func ToPtrs[T any](s []T) []*T {
res := make([]*T, len(s))
for i := range s {
res[i] = &s[i]
}
return res
}
func DerefSlice[T any](s []*T) []T {
res := make([]T, len(s))
for i := range s {
if s[i] != nil {
res[i] = *s[i]
}
}
return res
}