Skip to content

Commit

Permalink
调整sonic的使用
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Nov 29, 2024
1 parent 29b2c04 commit 5d79be8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/dbContext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"fmt"
"testing"

"github.com/bytedance/sonic"
"github.com/farseer-go/collections"
"github.com/farseer-go/data"
"github.com/farseer-go/fs/snc"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -44,7 +44,7 @@ type FullNameVO struct {

// Value return json value, implement driver.Valuer interface
func (receiver FullNameVO) Value() (driver.Value, error) {
ba, err := sonic.Marshal(receiver)
ba, err := snc.Marshal(receiver)
return string(ba), err
}

Expand All @@ -65,7 +65,7 @@ func (receiver *FullNameVO) Scan(val any) error {
}

t := FullNameVO{}
err := sonic.Unmarshal(ba, &t)
err := snc.Unmarshal(ba, &t)
*receiver = t
return err
}
Expand Down
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"go/ast"
"reflect"

"github.com/bytedance/sonic"
"github.com/farseer-go/fs/snc"
"gorm.io/gorm/schema"
)

Expand Down Expand Up @@ -39,7 +39,7 @@ func ToMap(entity any) map[string]any {

itemValue := fsVal.Field(i)
if isJsonField {
marshal, _ := sonic.Marshal(itemValue.Interface())
marshal, _ := snc.Marshal(itemValue.Interface())
itemValue = reflect.ValueOf(marshal)
}
dicValue.SetMapIndex(reflect.ValueOf(fieldName), itemValue)
Expand Down

0 comments on commit 5d79be8

Please sign in to comment.