26 lines
447 B
Go
26 lines
447 B
Go
package types
|
|
|
|
import "fmt"
|
|
|
|
// UserSex 用户性别
|
|
type UserSex int
|
|
|
|
const (
|
|
UserSexMale UserSex = iota + 1 // 男
|
|
UserSexFemale // 女
|
|
UserSexUnknown // 未知
|
|
)
|
|
|
|
var userSexMap = map[UserSex]string{
|
|
UserSexMale: "男",
|
|
UserSexFemale: "女",
|
|
UserSexUnknown: "未知",
|
|
}
|
|
|
|
func (u UserSex) String() string {
|
|
if v, ok := userSexMap[u]; ok {
|
|
return v
|
|
}
|
|
return fmt.Sprintf("性别<%d>", u)
|
|
}
|