Skip to content

Commit

Permalink
feat: remove unsafe.Slice in om to support go1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
rueian committed Dec 29, 2023
1 parent f1d67e2 commit 831ef08
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions om/conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package om
import (
"encoding/json"
"fmt"
"github.com/redis/rueidis"
"reflect"
"strconv"

"github.com/redis/rueidis"
)

func newHashConvFactory(t reflect.Type, schema schema) *hashConvFactory {
Expand Down Expand Up @@ -68,7 +67,7 @@ func (r hashConv) FromHash(fields map[string]string) error {
continue
}
if f.conv.StringToValue == nil {
if err := json.Unmarshal(unsafe.Slice(unsafe.StringData(v), len(v)), r.entity.Field(f.idx).Addr().Interface()); err != nil {
if err := json.Unmarshal([]byte(v), r.entity.Field(f.idx).Addr().Interface()); err != nil {
return err
}
} else {
Expand Down

0 comments on commit 831ef08

Please sign in to comment.