MCPcopy Create free account
hub / github.com/cockroachdb/apd / Scan

Method Scan

decimal.go:774–791  ·  view source on GitHub ↗

Scan implements the database/sql.Scanner interface. It supports string, []byte, int64, float64.

(src interface{})

Source from the content-addressed store, hash-verified

772// Scan implements the database/sql.Scanner interface. It supports string,
773// []byte, int64, float64.
774func (d *Decimal) Scan(src interface{}) error {
775 switch src := src.(type) {
776 case []byte:
777 _, _, err := d.SetString(string(src))
778 return err
779 case string:
780 _, _, err := d.SetString(src)
781 return err
782 case int64:
783 d.SetInt64(src)
784 return nil
785 case float64:
786 _, err := d.SetFloat64(src)
787 return err
788 default:
789 return fmt.Errorf("could not convert %T to Decimal", src)
790 }
791}
792
793// UnmarshalText implements the encoding.TextUnmarshaler interface.
794func (d *Decimal) UnmarshalText(b []byte) error {

Callers 1

ScanMethod · 0.45

Calls 3

SetStringMethod · 0.95
SetInt64Method · 0.95
SetFloat64Method · 0.95

Tested by

no test coverage detected