// CastToBoolean takes an interface{} type or any Object type and
// attempts to convert it to the Boolean Object type.
CastToBoolean takes an interface{} type or any Object type and
attempts to convert it to the Boolean Object type.
// CastToBoolean takes an interface {} type or any Object type and // attempts to convert it to the Boolean Object type .
func CastToBoolean(v interface{}) (Boolean, bool) {
	switch pt := v.(type) {
	case *Boolean:
		return *pt, true
	case Boolean:
		return pt, true
	case *bool:
		t := *pt
		return Boolean(t), true
	case bool:
		t := pt
		return Boolean(t), true
	case *Date32:
		t := *pt
		return Boolean(t != 0), true
	case Date32:
		t := pt
		return Boolean(t != 0), true
	case *Date64:
		t := *pt
		return Boolean(t != 0), true
	case Date64:
		t := pt
		return Boolean(t != 0), true
	case *DayTimeInterval:
		t := *pt
		return Boolean(t.Days != 0 || t.Milliseconds != 0), true
	case DayTimeInterval:
		t := pt
		return Boolean(t.Days != 0 || t.Milliseconds != 0), true
	case *Decimal128:
		t := *pt
		return Boolean(t.Sign() != 0), true
	case Decimal128:
		t := pt
		return Boolean(t.Sign() != 0), true
	case *Duration:
		t := *pt
		return Boolean(t != 0), true
	case Duration:
		t := pt
		return Boolean(t != 0), true
	case *Float16:
		t := *pt
		return Boolean(t.Uint16() != 0), true
	case Float16:
		t := pt
		return Boolean(t.Uint16() != 0), true
	case *Float32:
		t := *pt
		return Boolean(t != 0.0), true
	case Float32:
		t := pt
		return Boolean(t != 0.0), true
	case *Float64:
		t := *pt
		return Boolean(t != 0.0), true
	case Float64:
		t := pt
		return Boolean(t != 0.0), true
	case *Int16:
		t := *pt
		return Boolean(t != 0), true
	case Int16:
		t := pt
		return Boolean(t != 0), true
	case *Int32:
		t := *pt
		return Boolean(t != 0), true
	case Int32:
		t := pt
		return Boolean(t != 0), true
	case *Int64:
		t := *pt
		return Boolean(t != 0), true
	case Int64:
		t := pt
		return Boolean(t != 0), true
	case *Int8:
		t := *pt
		return Boolean(t != 0), true
	case Int8:
		t := pt
		return Boolean(t != 0), true
	case *MonthInterval:
		t := *pt
		return Boolean(t != 0), true
	case MonthInterval:
		t := pt
		return Boolean(t != 0), true
	case *Null:
		t := *pt
		return t.ToBoolean(), true
	case Null:
		t := pt
		return t.ToBoolean(), true
	case *String:
		t := *pt
		return Boolean(t != ""), true
	case String:
		t := pt
		return Boolean(t != ""), true
	case *Time32:
		t := *pt
		return Boolean(t != 0), true
	case Time32:
		t := pt
		return Boolean(t != 0), true
	case *Time64:
		t := *pt
		return Boolean(t != 0), true
	case Time64:
		t := pt
		return Boolean(t != 0), true
	case *Timestamp:
		t := *pt
		return Boolean(t != 0), true
	case Timestamp:
		t := pt
		return Boolean(t != 0), true
	case *Uint16:
		t := *pt
		return Boolean(t != 0), true
	case Uint16:
		t := pt
		return Boolean(t != 0), true
	case *Uint32:
		t := *pt
		return Boolean(t != 0), true
	case Uint32:
		t := pt
		return Boolean(t != 0), true
	case *Uint64:
		t := *pt
		return Boolean(t != 0), true
	case Uint64:
		t := pt
		return Boolean(t != 0), true
	case *Uint8:
		t := *pt
		return Boolean(t != 0), true
	case Uint8:
		t := pt
		return Boolean(t != 0), true
	default:
		return false, false
	}
}
func CastToBoolean ( v interface { } ) ( Boolean , bool ) { switch pt := v . ( type ) { case * Boolean : return * pt , true case Boolean : return pt , true case * bool : t := * pt return Boolean ( t ) , true case bool : t := pt return Boolean ( t ) , true case * Date32 : t := * pt return Boolean ( t != 0 ) , true case Date32 : t := pt return Boolean ( t != 0 ) , true case * Date64 : t := * pt return Boolean ( t != 0 ) , true case Date64 : t := pt return Boolean ( t != 0 ) , true case * DayTimeInterval : t := * pt return Boolean ( t . Days != 0 || t . Milliseconds != 0 ) , true case DayTimeInterval : t := pt return Boolean ( t . Days != 0 || t . Milliseconds != 0 ) , true case * Decimal128 : t := * pt return Boolean ( t . Sign ( ) != 0 ) , true case Decimal128 : t := pt return Boolean ( t . Sign ( ) != 0 ) , true case * Duration : t := * pt return Boolean ( t != 0 ) , true case Duration : t := pt return Boolean ( t != 0 ) , true case * Float16 : t := * pt return Boolean ( t . Uint16 ( ) != 0 ) , true case Float16 : t := pt return Boolean ( t . Uint16 ( ) != 0 ) , true case * Float32 : t := * pt return Boolean ( t != 0.0 ) , true case Float32 : t := pt return Boolean ( t != 0.0 ) , true case * Float64 : t := * pt return Boolean ( t != 0.0 ) , true case Float64 : t := pt return Boolean ( t != 0.0 ) , true case * Int16 : t := * pt return Boolean ( t != 0 ) , true case Int16 : t := pt return Boolean ( t != 0 ) , true case * Int32 : t := * pt return Boolean ( t != 0 ) , true case Int32 : t := pt return Boolean ( t != 0 ) , true case * Int64 : t := * pt return Boolean ( t != 0 ) , true case Int64 : t := pt return Boolean ( t != 0 ) , true case * Int8 : t := * pt return Boolean ( t != 0 ) , true case Int8 : t := pt return Boolean ( t != 0 ) , true case * MonthInterval : t := * pt return Boolean ( t != 0 ) , true case MonthInterval : t := pt return Boolean ( t != 0 ) , true case * Null : t := * pt return t . ToBoolean ( ) , true case Null : t := pt return t . ToBoolean ( ) , true case * String : t := * pt return Boolean ( t != " " ) , true case String : t := pt return Boolean ( t != " " ) , true case * Time32 : t := * pt return Boolean ( t != 0 ) , true case Time32 : t := pt return Boolean ( t != 0 ) , true case * Time64 : t := * pt return Boolean ( t != 0 ) , true case Time64 : t := pt return Boolean ( t != 0 ) , true case * Timestamp : t := * pt return Boolean ( t != 0 ) , true case Timestamp : t := pt return Boolean ( t != 0 ) , true case * Uint16 : t := * pt return Boolean ( t != 0 ) , true case Uint16 : t := pt return Boolean ( t != 0 ) , true case * Uint32 : t := * pt return Boolean ( t != 0 ) , true case Uint32 : t := pt return Boolean ( t != 0 ) , true case * Uint64 : t := * pt return Boolean ( t != 0 ) , true case Uint64 : t := pt return Boolean ( t != 0 ) , true case * Uint8 : t := * pt return Boolean ( t != 0 ) , true case Uint8 : t := pt return Boolean ( t != 0 ) , true default : return false , false } }
CastToBoolean takes an interface{} type or any Object type and
attempts to convert it to the Boolean Object type.
CastToBoolean takes an interface {} type or any Object type and attempts to convert it to the Boolean Object type .
// Also handles when v is nil