func (d *Decimal) Scan(src interface{}) error {

	b, ok := src.([]byte)
	if !ok {
		return fmt.Errorf("decimal: invalid data type %T", src)
	}

	if len(b) != decimalSize {
		return fmt.Errorf("decimal: invalid size %d of %v - %d expected", len(b), b, decimalSize)
	}

	if (b[15] & 0x60) == 0x60 {
		return fmt.Errorf("decimal: format (infinity, nan, ...) not supported : %v", b)
	}

	v := (*big.Rat)(d)
	p := v.Num()
	q := v.Denom()

	neg, exp := decodeDecimal(b, p)

	switch {
	case exp < 0:
		q.Set(exp10(exp * -1))
	case exp == 0:
		q.Set(natOne)
	case exp > 0:
		p.Mul(p, exp10(exp))
		q.Set(natOne)
	}

	if neg {
		v.Neg(v)
	}
	return nil
}
func (d *Decimal) Scan(src interface{}) error {

	b, ok := src.([]byte)
	if !ok {
		return fmt.Errorf("decimal: invalid data type %T", src)
	}

	if len(b) != decimalSize {
		return fmt.Errorf("decimal: invalid size %d of %v - %d expected", len(b), b, decimalSize)
	}

	if (b[15] & 0x60) == 0x60 {
		return fmt.Errorf("decimal: format (infinity, nan, ...) not supported : %v", b)
	}

	v := (*big.Rat)(d)
	p := v.Num()
	q := v.Denom()

	neg, exp := decodeDecimal(b, p)

	switch {
	case exp < 0:
		q.Set(exp10(exp * -1))
	case exp == 0:
		q.Set(natOne)
	case exp > 0:
		p.Mul(p, exp10(exp))
		q.Set(natOne)
	}

	if neg {
		v.Neg(v)
	}
	return nil
}
func ( d * Decimal ) Scan ( src interface { } ) error { b , ok := src . ( [ ] byte ) if ! ok { return fmt . Errorf ( " " , src ) } if len ( b ) != decimalSize { return fmt . Errorf ( " " , len ( b ) , b , decimalSize ) } if ( b [ 15 ] & 0x60 ) == 0x60 { return fmt . Errorf ( " " , b ) } v := ( * big . Rat ) ( d ) p := v . Num ( ) q := v . Denom ( ) neg , exp := decodeDecimal ( b , p ) switch { case exp < 0 : q . Set ( exp10 ( exp * - 1 ) ) case exp == 0 : q . Set ( natOne ) case exp > 0 : p . Mul ( p , exp10 ( exp ) ) q . Set ( natOne ) } if neg { v . Neg ( v ) } return nil }
// Scan implements the database/sql/Scanner interface.
Scan implements the database / sql / Scanner interface .