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)
| 664 | // digits) and at most "scale" # of decimal digits after the decimal point |
| 665 | // (0 = unspecified number of digits). scale must be <= precision. |
| 666 | func MakeDecimal(precision, scale int32) *T { |
| 667 | if precision == 0 && scale == 0 { |
| 668 | return Decimal |
| 669 | } |
| 670 | if precision < 0 { |
| 671 | panic(errors.AssertionFailedf("precision %d cannot be negative", precision)) |
| 672 | } |
| 673 | if scale < 0 { |
| 674 | panic(errors.AssertionFailedf("scale %d cannot be negative", scale)) |
| 675 | } |
| 676 | if scale > precision { |
| 677 | panic(errors.AssertionFailedf( |
| 678 | "scale %d cannot be larger than precision %d", scale, precision)) |
| 679 | } |
| 680 | return &T{InternalType: InternalType{ |
| 681 | Family: DecimalFamily, |
| 682 | Oid: oid.T_numeric, |
| 683 | Precision: precision, |
| 684 | Width: scale, |
| 685 | Locale: &emptyLocale, |
| 686 | }} |
| 687 | } |
| 688 | |
| 689 | // MakeTime constructs a new instance of a TIME type (oid = T_time) that has at |
| 690 | // most the given number of fractional second digits. |
no outgoing calls
no test coverage detected
searching dependent graphs…