go-wxhelper/pkg/types/userinfo.go

26 lines
447 B
Go
Raw Normal View History

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)
}