(refreshInterval RefreshInterval)
| 97 | } |
| 98 | |
| 99 | func validateRefreshInterval(refreshInterval RefreshInterval) error { |
| 100 | if n := refreshInterval.N; n < 1 { |
| 101 | return errors.Errorf("bad interval value: %d", n) |
| 102 | } |
| 103 | for _, unit := range []string{"days", "hours", "minutes", "seconds", "milliseconds"} { |
| 104 | if refreshInterval.Unit == unit { |
| 105 | return nil |
| 106 | } |
| 107 | } |
| 108 | return errors.Errorf("bad interval unit: %s", refreshInterval.Unit) |
| 109 | } |
| 110 | |
| 111 | // ParseFilenameInterval parses the filename to extract the refresh interval |
| 112 | // or returns a default if it is do so. |
no outgoing calls