GetTime returns the underlying time structure from the parameter.
(name string)
| 629 | |
| 630 | // GetTime returns the underlying time structure from the parameter. |
| 631 | func (pars Params) GetTime(name string) (time.Time, error) { |
| 632 | par, err := pars.findParam(name) |
| 633 | if err != nil { |
| 634 | return time.Unix(0, 0), err |
| 635 | } |
| 636 | v, ok := par.Value.(time.Time) |
| 637 | if !ok { |
| 638 | return time.Unix(0, 0), fmt.Errorf("unable to type cast %q parameter to Time value", name) |
| 639 | } |
| 640 | return v, nil |
| 641 | } |
| 642 | |
| 643 | // MustGetTime returns the underlying time structure from the parameter or panics |
| 644 | // if any errors occur. |
no test coverage detected