package postgres import "github.com/jackc/pgtype" type Numeric struct { pgtype.Numeric } func (n Numeric) GetFloat64() float64 { if n.Status != pgtype.Present { return 0 } var balance float64 err := n.AssignTo(&balance) if err != nil { panic(err) } return balance } func (n Numeric) IsPositive() bool { if n.Status != pgtype.Present { return true } float := n.GetFloat64() return float >= 0 } func (n Numeric) IsZero() bool { if n.Status != pgtype.Present { return true } float := n.GetFloat64() return float == 0 }