MakeDecimal constructs a new instance of a DECIMAL type (oid = T_numeric) that has at most "precision" # of decimal digits (0 = unspecified number of digits) and at most "scale" # of decimal digits after the decimal point (0 = unspecified number of digits). scale must be <= precision.
(precision, scale int32)
| 1012 | // digits) and at most "scale" # of decimal digits after the decimal point |
| 1013 | // (0 = unspecified number of digits). scale must be <= precision. |
| 1014 | func MakeDecimal(precision, scale int32) *T { |
| 1015 | if precision == 0 && scale == 0 { |
| 1016 | return Decimal |
| 1017 | } |
| 1018 | if precision < 0 { |
| 1019 | panic(errors.AssertionFailedf("precision %d cannot be negative", precision)) |
| 1020 | } |
| 1021 | if scale < 0 { |
| 1022 | panic(errors.AssertionFailedf("scale %d cannot be negative", scale)) |
| 1023 | } |
| 1024 | if scale > precision { |
| 1025 | panic(errors.AssertionFailedf( |
| 1026 | "scale %d cannot be larger than precision %d", scale, precision)) |
| 1027 | } |
| 1028 | return &T{InternalType: InternalType{ |
| 1029 | Family: DecimalFamily, |
| 1030 | Oid: oid.T_numeric, |
| 1031 | Precision: precision, |
| 1032 | Width: scale, |
| 1033 | Locale: &emptyLocale, |
| 1034 | }} |
| 1035 | } |
| 1036 | |
| 1037 | // MakeTime constructs a new instance of a TIME type (oid = T_time) that has at |
| 1038 | // most the given number of fractional second digits. |
no outgoing calls
no test coverage detected
searching dependent graphs…