File size: 428 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
package rotation
import (
"time"
"github.com/target/goalert/validation/validate"
)
type State struct {
RotationID string
ParticipantID string
Position int
ShiftStart time.Time
}
func (s State) Normalize() (*State, error) {
err := validate.Many(
validate.UUID("ParticipantID", s.ParticipantID),
validate.Range("Position", s.Position, 0, 9000),
)
if err != nil {
return nil, err
}
return &s, nil
}
|