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

Method AvailableTypes

pkg/sql/sem/tree/constant.go:299–315  ·  view source on GitHub ↗

AvailableTypes implements the Constant interface.

()

Source from the content-addressed store, hash-verified

297
298// AvailableTypes implements the Constant interface.
299func (expr *NumVal) AvailableTypes() []*types.T {
300 if i, err := expr.AsInt64(); err == nil {
301 noOid := intIsOutOfOIDRange(DInt(i))
302 intKind := expr.Kind() == constant.Int
303 switch {
304 case noOid && intKind:
305 return NumValAvailIntegerNoOid
306 case noOid && !intKind:
307 return NumValAvailDecimalNoFractionNoOid
308 case !noOid && intKind:
309 return NumValAvailInteger
310 case !noOid && !intKind:
311 return NumValAvailDecimalNoFraction
312 }
313 }
314 return NumValAvailDecimalWithFraction
315}
316
317// DesirableTypes implements the Constant interface.
318func (expr *NumVal) DesirableTypes() []*types.T {

Callers

nothing calls this directly

Calls 4

AsInt64Method · 0.95
KindMethod · 0.95
intIsOutOfOIDRangeFunction · 0.85
DIntTypeAlias · 0.85

Tested by

no test coverage detected