MCPcopy Create free account
hub / github.com/apecloud/myduckserver / DecodePrecisionScale

Function DecodePrecisionScale

pgtypes/pgtypes.go:461–471  ·  view source on GitHub ↗
(typmod int)

Source from the content-addressed store, hash-verified

459
460func (p PostgresType) String() string {
461 return fmt.Sprintf("PostgresType(%s)", p.PG.Name)
462}
463
464func DecodePrecisionScale(typmod int) (precision, scale int32, ok bool) {
465 if typmod > 0 {
466 typmod -= 4 // remove VARHDRSZ
467 precision = int32((typmod >> 16) & 0xFFFF)
468 scale = int32(typmod & 0xFFFF)
469 ok = true
470 }
471 // The max precision is 131072, which is larger than the max int16 value.
472 // Therefore, if the precision is larger than the max int16 value, we default to unknown precision and scale.
473 return
474}

Callers 3

pgTypeNameFunction · 0.92
decodeToArrowFunction · 0.92
NewPostgresTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected