Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions riverdriver/riverpgxv5/json_text_mode_adaptation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"regexp"
"strconv"
"strings"
"sync"

"github.com/jackc/pgx/v5"
)
Expand Down Expand Up @@ -39,13 +38,7 @@ type jsonPlaceholderCast struct {
isArray bool
}

var jsonCastPlaceholderCache sync.Map //nolint:gochecknoglobals // Cache cast parsing for hot query paths.

func jsonPlaceholderCasts(sql string) []jsonPlaceholderCast {
if cached, ok := jsonCastPlaceholderCache.Load(sql); ok {
return cached.([]jsonPlaceholderCast) //nolint:forcetypeassert
}

matches := jsonCastPlaceholderRegexp.FindAllStringSubmatch(sql, -1)
casts := make([]jsonPlaceholderCast, 0, len(matches))
seen := make(map[int]int, len(matches))
Expand Down Expand Up @@ -76,7 +69,6 @@ func jsonPlaceholderCasts(sql string) []jsonPlaceholderCast {
casts = append(casts, cast)
}

jsonCastPlaceholderCache.Store(sql, casts)
return casts
}

Expand Down
Loading