MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / getCacheEntry

Method getCacheEntry

pkg/sql/sem/tree/datum.go:1246–1264  ·  view source on GitHub ↗
(
	locale string,
)

Source from the content-addressed store, hash-verified

1244}
1245
1246func (env *CollationEnvironment) getCacheEntry(
1247 locale string,
1248) (collationEnvironmentCacheEntry, error) {
1249 entry, ok := env.cache[locale]
1250 if !ok {
1251 if env.cache == nil {
1252 env.cache = make(map[string]collationEnvironmentCacheEntry)
1253 }
1254 tag, err := language.Parse(locale)
1255 if err != nil {
1256 err = errors.NewAssertionErrorWithWrappedErrf(err, "failed to parse locale %q", locale)
1257 return collationEnvironmentCacheEntry{}, err
1258 }
1259
1260 entry = collationEnvironmentCacheEntry{locale, collate.New(tag)}
1261 env.cache[locale] = entry
1262 }
1263 return entry, nil
1264}
1265
1266// NewDCollatedString is a helper routine to create a *DCollatedString. Panics
1267// if locale is invalid. Not safe for concurrent use.

Callers 1

NewDCollatedStringFunction · 0.80

Calls 1

ParseMethod · 0.65

Tested by

no test coverage detected