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