ParseStatus attempts to convert a string to a Status.
(name string)
| 120 | |
| 121 | // ParseStatus attempts to convert a string to a Status. |
| 122 | func ParseStatus(name string) (Status, error) { |
| 123 | if x, ok := _StatusValue[name]; ok { |
| 124 | return x, nil |
| 125 | } |
| 126 | // Case insensitive parse, do a separate lookup to prevent unnecessary cost of lowercasing a string if we don't need to. |
| 127 | if x, ok := _StatusValue[strings.ToLower(name)]; ok { |
| 128 | return x, nil |
| 129 | } |
| 130 | return Status(0), fmt.Errorf("%s is %w", name, ErrInvalidStatus) |
| 131 | } |
searching dependent graphs…