MCPcopy Create free account
hub / github.com/dolthub/doltgresql / NewNumericTypeWithPrecisionAndScale

Function NewNumericTypeWithPrecisionAndScale

server/types/numeric.go:81–88  ·  view source on GitHub ↗

NewNumericTypeWithPrecisionAndScale returns Numeric type with typmod set.

(precision, scale int32)

Source from the content-addressed store, hash-verified

79
80// NewNumericTypeWithPrecisionAndScale returns Numeric type with typmod set.
81func NewNumericTypeWithPrecisionAndScale(precision, scale int32) (*DoltgresType, error) {
82 typmod, err := GetTypmodFromNumericPrecisionAndScale(precision, scale)
83 if err != nil {
84 return nil, err
85 }
86 newType := *Numeric.WithAttTypMod(typmod)
87 return &newType, nil
88}
89
90// GetTypmodFromNumericPrecisionAndScale takes Numeric type precision and scale and returns the type modifier value.
91func GetTypmodFromNumericPrecisionAndScale(precision, scale int32) (int32, error) {

Callers

nothing calls this directly

Calls 2

WithAttTypModMethod · 0.80

Tested by

no test coverage detected