// CastToDecimal128 takes an interface{} type or any Object type and
// attempts to convert it to the Decimal128 Object type.
CastToDecimal128 takes an interface{} type or any Object type and
attempts to convert it to the Decimal128 Object type.
// CastToDecimal128 takes an interface {} type or any Object type and // attempts to convert it to the Decimal128 Object type .
func CastToDecimal128(v interface{}) (Decimal128, bool) {
	switch pt := v.(type) {
	case *Decimal128:
		return *pt, true
	case Decimal128:
		return pt, true
	case *decimal128.Num:
		t := *pt
		return Decimal128(t), true
	case decimal128.Num:
		t := pt
		return Decimal128(t), true
	case *Boolean:
		t := *pt
		return func(t Boolean) Decimal128 {
			if t {
				return NewDecimal128FromU64(1)
			}
			return NewDecimal128FromU64(0)
		}(t), true
	case Boolean:
		t := pt
		return func(t Boolean) Decimal128 {
			if t {
				return NewDecimal128FromU64(1)
			}
			return NewDecimal128FromU64(0)
		}(t), true
	case *Int64:
		t := *pt
		return Decimal128(decimal128.FromI64(int64(t))), true
	case Int64:
		t := pt
		return Decimal128(decimal128.FromI64(int64(t))), true
	case *Uint64:
		t := *pt
		return Decimal128(decimal128.FromU64(uint64(t))), true
	case Uint64:
		t := pt
		return Decimal128(decimal128.FromU64(uint64(t))), true
	default:
		return Decimal128(decimal128.New(0, 0)), false
	}
}
func CastToDecimal128 ( v interface { } ) ( Decimal128 , bool ) { switch pt := v . ( type ) { case * Decimal128 : return * pt , true case Decimal128 : return pt , true case * decimal128 . Num : t := * pt return Decimal128 ( t ) , true case decimal128 . Num : t := pt return Decimal128 ( t ) , true case * Boolean : t := * pt return func ( t Boolean ) Decimal128 { if t { return NewDecimal128FromU64 ( 1 ) } return NewDecimal128FromU64 ( 0 ) } ( t ) , true case Boolean : t := pt return func ( t Boolean ) Decimal128 { if t { return NewDecimal128FromU64 ( 1 ) } return NewDecimal128FromU64 ( 0 ) } ( t ) , true case * Int64 : t := * pt return Decimal128 ( decimal128 . FromI64 ( int64 ( t ) ) ) , true case Int64 : t := pt return Decimal128 ( decimal128 . FromI64 ( int64 ( t ) ) ) , true case * Uint64 : t := * pt return Decimal128 ( decimal128 . FromU64 ( uint64 ( t ) ) ) , true case Uint64 : t := pt return Decimal128 ( decimal128 . FromU64 ( uint64 ( t ) ) ) , true default : return Decimal128 ( decimal128 . New ( 0 , 0 ) ) , false } }
CastToDecimal128 takes an interface{} type or any Object type and
attempts to convert it to the Decimal128 Object type.
CastToDecimal128 takes an interface {} type or any Object type and attempts to convert it to the Decimal128 Object type .
// Also handles when v is nil