28 lines
362 B
Go
28 lines
362 B
Go
|
package permission
|
||
|
|
||
|
type Status int8
|
||
|
|
||
|
const (
|
||
|
Open Status = iota + 1
|
||
|
Close
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
ClosePermission string = "close"
|
||
|
OpenPermission string = "open"
|
||
|
)
|
||
|
|
||
|
func (s Status) String() string {
|
||
|
status, ok := statusMap[s]
|
||
|
if ok {
|
||
|
return status
|
||
|
}
|
||
|
|
||
|
return ClosePermission
|
||
|
}
|
||
|
|
||
|
var statusMap = map[Status]string{
|
||
|
Open: OpenPermission,
|
||
|
Close: ClosePermission,
|
||
|
}
|