Remove deadcode

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-13 16:50:35 +01:00
parent 7fd4221199
commit ef76a8d2e1
76 changed files with 137 additions and 4424 deletions

View File

@@ -93,96 +93,6 @@ func Before(t any) ValidatorFunc {
}
}
// FutureDate validates that a time is in the future.
func FutureDate() ValidatorFunc {
return func(value any) *ValidationError {
actualValue, isNil := dereferenceValue(value)
if isNil {
return nil
}
timeVal, ok := actualValue.(time.Time)
if !ok {
return newValidationError(ErrorCodeInvalidFormat, "value must be a time.Time")
}
if !timeVal.After(time.Now()) {
return newValidationError(ErrorCodeOutOfRange, "must be a future date")
}
return nil
}
}
// PastDate validates that a time is in the past.
func PastDate() ValidatorFunc {
return func(value any) *ValidationError {
actualValue, isNil := dereferenceValue(value)
if isNil {
return nil
}
timeVal, ok := actualValue.(time.Time)
if !ok {
return newValidationError(ErrorCodeInvalidFormat, "value must be a time.Time")
}
if !timeVal.Before(time.Now()) {
return newValidationError(ErrorCodeOutOfRange, "must be a past date")
}
return nil
}
}
// MinDuration validates that a duration is at least the specified minimum value.
func MinDuration(min time.Duration) ValidatorFunc {
return func(value any) *ValidationError {
actualValue, isNil := dereferenceValue(value)
if isNil {
return nil
}
duration, ok := actualValue.(time.Duration)
if !ok {
return newValidationError(ErrorCodeInvalidFormat, "value must be a time.Duration")
}
if duration < min {
return newValidationError(
ErrorCodeOutOfRange,
fmt.Sprintf("must be at least %s", min),
)
}
return nil
}
}
// MaxDuration validates that a duration does not exceed the specified maximum value.
func MaxDuration(max time.Duration) ValidatorFunc {
return func(value any) *ValidationError {
actualValue, isNil := dereferenceValue(value)
if isNil {
return nil
}
duration, ok := actualValue.(time.Duration)
if !ok {
return newValidationError(ErrorCodeInvalidFormat, "value must be a time.Duration")
}
if duration > max {
return newValidationError(
ErrorCodeOutOfRange,
fmt.Sprintf("must be at most %s", max),
)
}
return nil
}
}
// RangeDuration validates that a duration is within the specified range (inclusive).
func RangeDuration(min, max time.Duration) ValidatorFunc {
return func(value any) *ValidationError {