You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
297 B
15 lines
297 B
package models
|
|
|
|
type betweenContract[T any] interface {
|
|
Before(other T) bool
|
|
IsZero() bool
|
|
}
|
|
|
|
type TimeInterval[T betweenContract[T]] struct {
|
|
Min T `json:"min"`
|
|
Max T `json:"max"`
|
|
}
|
|
|
|
func (b *TimeInterval[T]) Valid() bool {
|
|
return !b.Min.IsZero() && !b.Max.IsZero() && b.Min.Before(b.Max)
|
|
}
|