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

Function AsDInt

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

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

(e Expr)

Source from the content-addressed store, hash-verified

681// be used instead of direct type assertions wherever a *DInt wrapped by a
682// *DOidWrapper is possible.
683func AsDInt(e Expr) (DInt, bool) {
684 switch t := e.(type) {
685 case *DInt:
686 return *t, true
687 case *DOidWrapper:
688 return AsDInt(t.Wrapped)
689 }
690 return 0, false
691}
692
693// MustBeDInt attempts to retrieve a DInt from an Expr, panicking if the
694// assertion fails.

Callers 3

MustBeDIntFunction · 0.85
MaxDistinctCountFunction · 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…