Documentation
¶
Overview ¶
Package postgres provides a simple wrapper around a decimal.Big type, allowing it to be used in PostgreSQL queries. It ensures the decimal fits inside the limits of the DECIMAL type.
Index ¶
Constants ¶
View Source
const ( MaxIntegralDigits = 131072 // max digits before the decimal point MaxFractionalDigits = 16383 // max digits after the decimal point )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decimal ¶
type Decimal struct { V *decimal.Big Round bool // round if the decimal exceeds the bounds for DECIMAL Zero bool // return "0" if V == nil }
Decimal is a PostgreSQL DECIMAL. Its zero value is valid for use with both Value and Scan.
type LengthError ¶
type LengthError struct { Part string // "integral" or "fractional" N int // length of invalid part // contains filtered or unexported fields }
LengthError is returned from Decimal.Value when either its integral (digits before the decimal point) or fractional (digits after the decimal point) parts are too long for PostgresSQL.
func (LengthError) Error ¶
func (e LengthError) Error() string
Click to show internal directories.
Click to hide internal directories.