MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / AsDString

Function AsDString

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

AsDString attempts to retrieve a DString from an Expr, returning a DString and a flag signifying whether the assertion was successful. The function should be used instead of direct type assertions wherever a *DString wrapped by a *DOidWrapper is possible.

(e Expr)

Source from the content-addressed store, hash-verified

1206// be used instead of direct type assertions wherever a *DString wrapped by a
1207// *DOidWrapper is possible.
1208func AsDString(e Expr) (DString, bool) {
1209 switch t := e.(type) {
1210 case *DString:
1211 return *t, true
1212 case *DOidWrapper:
1213 return AsDString(t.Wrapped)
1214 }
1215 return "", false
1216}
1217
1218// MustBeDString attempts to retrieve a DString from an Expr, panicking if the
1219// assertion fails.

Callers 3

MustBeDStringFunction · 0.85
MustBeDStringOrDNullFunction · 0.85
AdjustValueToTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…