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

Function NewDCollatedString

pkg/sql/sem/tree/datum.go:1268–1283  ·  view source on GitHub ↗

NewDCollatedString is a helper routine to create a *DCollatedString. Panics if locale is invalid. Not safe for concurrent use.

(
	contents string, locale string, env *CollationEnvironment,
)

Source from the content-addressed store, hash-verified

1266// NewDCollatedString is a helper routine to create a *DCollatedString. Panics
1267// if locale is invalid. Not safe for concurrent use.
1268func NewDCollatedString(
1269 contents string, locale string, env *CollationEnvironment,
1270) (*DCollatedString, error) {
1271 entry, err := env.getCacheEntry(locale)
1272 if err != nil {
1273 return nil, err
1274 }
1275 if env.buffer == nil {
1276 env.buffer = &collate.Buffer{}
1277 }
1278 key := entry.collator.KeyFromString(env.buffer, contents)
1279 d := DCollatedString{contents, entry.locale, make([]byte, len(key))}
1280 copy(d.Key, key)
1281 env.buffer.Reset()
1282 return &d, nil
1283}
1284
1285// AmbiguousFormat implements the Datum interface.
1286func (*DCollatedString) AmbiguousFormat() bool { return false }

Callers 3

NewDefaultDatumFunction · 0.85
PerformCastFunction · 0.85
EvalMethod · 0.85

Calls 2

getCacheEntryMethod · 0.80
ResetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…