sqlbigrat

package module
v0.0.0-...-d8f9b93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 5 Imported by: 0

README

sqlbigrat

big.Rat with sql.Scanner and driver.Valuer

I made this struct for catching decimal type BIGNUMERIC from BigQuery in Google Cloud Platform through GORM.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rat

type Rat struct {
	*big.Rat
}

func NewFromFloat

func NewFromFloat(f float64) *Rat

func NewFromInt

func NewFromInt(i int64) *Rat

func NewFromString

func NewFromString(s string) (*Rat, error)

func NewFromUInt

func NewFromUInt(u uint64) *Rat

func (*Rat) Scan

func (r *Rat) Scan(src any) error

func (*Rat) String

func (r *Rat) String() string

func (*Rat) ToDecimal

func (r *Rat) ToDecimal(precision int32) decimal.Decimal

ToDecimal converts sqlbigrat.Rat into shopspring/decimal.Decimal, with given precision

func (*Rat) ToInt

func (r *Rat) ToInt(base, bitSize int) (int64, error)

ToInt returns integer part of sqlbigrat.Rat

func (*Rat) Value

func (r *Rat) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL