Documentation ¶
Index ¶
- Constants
- func CheckVerifyCode(phone, code string) int
- func CreateVerification(phone string) int
- func UpdateUser(user *User) int
- func UserPhoneExists(phone *string) bool
- type User
- func AuthWithQQ(openid, token, appId string) (*User, int)
- func AuthWithWeiBo(token string) (*User, int)
- func AuthWithWeiXin(openid, token string) (*User, int)
- func CreateUserByPhone(phone *string, secret string) (*User, int)
- func GetUserByToken(token string) (*User, int)
- func GetUserByUid(uid int64) (*User, int)
- func VerifyUserByPhone(phone *string, secret string) (*User, int)
- type Verification
Constants ¶
View Source
const DB_UNIQUE_CONFLICT_TRY int = 3
View Source
const USERS_TABLE_NAME string = "users"
View Source
const VERIFICATIONS_TABLE_NAME string = "verifications"
Variables ¶
This section is empty.
Functions ¶
func CheckVerifyCode ¶
func CreateVerification ¶
func UpdateUser ¶
TODO return more detailed error number NOTE: this will do a fully update, so the user must be read from DB, and then update its field
func UserPhoneExists ¶
Types ¶
type User ¶
type User struct { Id int64 `json:"-" orm:"pk;auto"` Uid int64 `json:"uid" orm:"column(uid);unique"` Token string `json:"token,omitempty" orm:"column(token);unique;size(40)"` Phone *string `json:"phone,omitempty" orm:"column(phone);null;unique;size(11)"` WeiXin *string `json:"-" orm:"column(weixin);null;unique;size(191)"` WeiBo *string `json:"-" orm:"column(weibo);null;unique;size(191)"` QQ *string `json:"-" orm:"column(qq);null;unique;size(191)"` Password string `json:"-" orm:"column(password);size(40)"` Nickname string `json:"nickname,omitempty" orm:"column(nickname);size(12)"` QQNickName string `json:"qq_nickname,omitempty" orm:"column(qq_nickname);size(127)"` WeiBoNickName string `json:"weibo_nickname,omitempty" orm:"column(weibo_nickname);size(127)"` WeiXinNickName string `json:"weixin_nickname,omitempty" orm:"column(weixin_nickname);size(127)"` Gender int `json:"gender" orm:"column(gender)"` Avatar string `json:"avatar,omitempty" orm:"column(avatar);size(191)"` CreateAt int64 `json:"create_at" orm:"column(create_at);unique"` UpdateAt int64 `json:"update_at" orm:"column(update_at);unique"` }
func AuthWithQQ ¶
func AuthWithWeiBo ¶
func AuthWithWeiXin ¶
func GetUserByToken ¶
func GetUserByUid ¶
type Verification ¶
type Verification struct { Id int64 `json:"-" orm:"pk;auto"` Phone string `json:"phone" orm:"column(phone);unique;index;size(20)"` Code string `json:"code" orm:"column(code);size(6)"` Expire int64 `json:"expire" orm:"column(expire)"` }
func (*Verification) TableName ¶
func (v *Verification) TableName() string
Click to show internal directories.
Click to hide internal directories.