Add support for configuring the JSON unmarshal function used when querying SELECT_JSON statements.

This commit is contained in:
go-jet 2025-03-11 13:33:39 +01:00
parent 7ab44bc61c
commit 1db6b12074
6 changed files with 74 additions and 3 deletions

View file

@ -2,6 +2,7 @@ package postgres
import (
"context"
"github.com/bytedance/sonic"
"github.com/go-jet/jet/v2/internal/testutils"
"github.com/go-jet/jet/v2/internal/utils/ptr"
. "github.com/go-jet/jet/v2/postgres"
@ -225,10 +226,24 @@ func BenchmarkJoinEverythingJSON(b *testing.B) {
}
}
func BenchmarkJoinEverythingJsonSonic(b *testing.B) {
useJsonUnmarshalFunc(sonic.Unmarshal, func() {
for i := 0; i < b.N; i++ {
testJoinEverythingJSON(b)
}
})
}
func TestJoinEverythingJSON(t *testing.T) {
testJoinEverythingJSON(t)
}
func TestJoinEverythingJSONSonic(t *testing.T) {
useJsonUnmarshalFunc(sonic.Unmarshal, func() {
testJoinEverythingJSON(t)
})
}
func testJoinEverythingJSON(t require.TestingT) {
manager := Employee.AS("Manager")