feat: add protobuf message compression and decompression for Redis; refactor product fetching logic
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user