// CastToDuration takes an interface{} type or any Object type and
// attempts to convert it to the Duration Object type.
CastToDuration takes an interface{} type or any Object type and
attempts to convert it to the Duration Object type.
// CastToDuration takes an interface {} type or any Object type and // attempts to convert it to the Duration Object type .
func CastToDuration(v interface{}) (Duration, bool) {
	switch pt := v.(type) {
	case *Duration:
		return *pt, true
	case Duration:
		return pt, true
	case *arrow.Duration:
		t := *pt
		return Duration(t), true
	case arrow.Duration:
		t := pt
		return Duration(t), true
	case *Boolean:
		t := *pt
		return func(t Boolean) Duration {
			if t {
				return Duration(1)
			}
			return Duration(0)
		}(t), true
	case Boolean:
		t := pt
		return func(t Boolean) Duration {
			if t {
				return Duration(1)
			}
			return Duration(0)
		}(t), true
	case *Int64:
		t := *pt
		return Duration(arrow.Duration(t)), true
	case Int64:
		t := pt
		return Duration(arrow.Duration(t)), true
	default:
		return 0, false
	}
}
func CastToDuration ( v interface { } ) ( Duration , bool ) { switch pt := v . ( type ) { case * Duration : return * pt , true case Duration : return pt , true case * arrow . Duration : t := * pt return Duration ( t ) , true case arrow . Duration : t := pt return Duration ( t ) , true case * Boolean : t := * pt return func ( t Boolean ) Duration { if t { return Duration ( 1 ) } return Duration ( 0 ) } ( t ) , true case Boolean : t := pt return func ( t Boolean ) Duration { if t { return Duration ( 1 ) } return Duration ( 0 ) } ( t ) , true case * Int64 : t := * pt return Duration ( arrow . Duration ( t ) ) , true case Int64 : t := pt return Duration ( arrow . Duration ( t ) ) , true default : return 0 , false } }
CastToDuration takes an interface{} type or any Object type and
attempts to convert it to the Duration Object type.
CastToDuration takes an interface {} type or any Object type and attempts to convert it to the Duration Object type .
// Also handles when v is nil