String implements Stringer interface: gets human-readable name for a numeric authentication level.
()
| 27 | |
| 28 | // String implements Stringer interface: gets human-readable name for a numeric authentication level. |
| 29 | func (a Level) String() string { |
| 30 | s, err := a.MarshalText() |
| 31 | if err != nil { |
| 32 | return "unkn" |
| 33 | } |
| 34 | return string(s) |
| 35 | } |
| 36 | |
| 37 | // ParseAuthLevel parses authentication level from a string. |
| 38 | func ParseAuthLevel(name string) Level { |