Documentation ¶
Index ¶
- type OnCreatedCallback
- type UserData
- type UserDataFromOAuthCode
- type UserModel
- type UserSystem
- func (u *UserSystem) AddMobileUser(info *auth.MobileUserInfo) (appgo.Id, error)
- func (u *UserSystem) AddOAuthUser(index int, id string, ui interface{}) (appgo.Id, error)
- func (u *UserSystem) AddQqUser(info *qq.UserInfo) (appgo.Id, error)
- func (u *UserSystem) AddWeiboUser(info *weibo.UserInfo) (appgo.Id, error)
- func (u *UserSystem) AddWeixinUser(info *weixin.UserInfo) (appgo.Id, error)
- func (u *UserSystem) CheckIn(id appgo.Id, role appgo.Role, newToken auth.Token) (banned bool, extraInfo interface{}, err error)
- func (u *UserSystem) CreateUser(user *UserData) (*UserData, error)
- func (u *UserSystem) DeleteUser(id appgo.Id) error
- func (u *UserSystem) GetMobileUser(mobile, password string) (appgo.Id, error)
- func (u *UserSystem) GetOAuthUser(index int, id string) (appgo.Id, error)
- func (u *UserSystem) GetOAuthUserInfo(index int, code string) (interface{}, string, error)
- func (u *UserSystem) GetPushTokens(ids []appgo.Id) (map[string]map[appgo.Id]*appgo.PushInfo, error)
- func (u *UserSystem) GetQqUser(openId string) (appgo.Id, error)
- func (u *UserSystem) GetUserModel(id appgo.Id) (*UserModel, error)
- func (u *UserSystem) GetWeiboUser(openId string) (appgo.Id, error)
- func (u *UserSystem) GetWeixinUser(unionId string) (appgo.Id, error)
- func (u *UserSystem) HasMobileUser(mobile string) (bool, error)
- func (u *UserSystem) ListUsers(offset, limit int) ([]*UserData, error)
- func (u *UserSystem) PushTo(users []appgo.Id, content *appgo.PushData)
- func (u *UserSystem) ReadUser(id appgo.Id) (*UserData, error)
- func (u *UserSystem) Search(keyword string, limit int) ([]*UserData, error)
- func (u *UserSystem) SetMobileForUser(mobile string, userId appgo.Id) error
- func (u *UserSystem) SetPushToken(id appgo.Id, platform appgo.Platform, provider, token string) error
- func (u *UserSystem) UpdateAppToken(id appgo.Id, role appgo.Role) (string, error)
- func (u *UserSystem) UpdatePushInfo(id appgo.Id, pushInfo *appgo.PushInfo) error
- func (u *UserSystem) UpdatePwByMobile(mobile, password string) error
- func (u *UserSystem) UpdateUser(id appgo.Id, user *UserData) (*UserData, error)
- func (u *UserSystem) UserCount() (int, error)
- func (u *UserSystem) Validate(token auth.Token) bool
- type UserSystemSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OnCreatedCallback ¶
type UserDataFromOAuthCode ¶
type UserModel ¶
type UserModel struct { Id appgo.Id Username sql.NullString `gorm:"size:63;unique_index"` Email sql.NullString `gorm:"size:63;unique_index"` Mobile sql.NullString `gorm:"size:15;unique_index"` PasswordSalt []byte `gorm:"size:64"` PasswordHash []byte `gorm:"size:64"` WeiboId sql.NullString `gorm:"size:63;unique_index"` WeixinUnionId sql.NullString `gorm:"size:63;unique_index"` QqOpenId sql.NullString `gorm:"size:63;unique_index"` OAuth0Id sql.NullString `gorm:"size:63;unique_index"` OAuth1Id sql.NullString `gorm:"size:63;unique_index"` // Only store appToken because webTokens are short lived AppToken sql.NullString `gorm:"size:127"` Role appgo.Role Platform appgo.Platform PushProvider sql.NullString `gorm:"size:16"` PushToken sql.NullString `gorm:"size:127"` Nickname sql.NullString `gorm:"size:63"` Portrait sql.NullString `gorm:"size:255"` Sex appgo.Sex BannedUntil *time.Time CreatedAt time.Time DeletedAt *time.Time }
type UserSystem ¶
type UserSystem struct { Pushers map[string]appgo.Pusher DefaultPusher appgo.Pusher OnCreated OnCreatedCallback OAuths []UserDataFromOAuthCode appgo.MobileMsgSender appgo.KvStore // contains filtered or unexported fields }
var U *UserSystem
func Init ¶
func Init(db *gorm.DB, settings UserSystemSettings) *UserSystem
func (*UserSystem) AddMobileUser ¶
func (u *UserSystem) AddMobileUser(info *auth.MobileUserInfo) (appgo.Id, error)
func (*UserSystem) AddOAuthUser ¶
func (*UserSystem) AddWeiboUser ¶
func (*UserSystem) AddWeixinUser ¶
func (*UserSystem) CreateUser ¶
func (u *UserSystem) CreateUser(user *UserData) (*UserData, error)
func (*UserSystem) DeleteUser ¶
func (u *UserSystem) DeleteUser(id appgo.Id) error
func (*UserSystem) GetMobileUser ¶
func (u *UserSystem) GetMobileUser(mobile, password string) (appgo.Id, error)
func (*UserSystem) GetOAuthUser ¶
func (*UserSystem) GetOAuthUserInfo ¶
func (u *UserSystem) GetOAuthUserInfo(index int, code string) (interface{}, string, error)
func (*UserSystem) GetPushTokens ¶
func (*UserSystem) GetUserModel ¶
func (u *UserSystem) GetUserModel(id appgo.Id) (*UserModel, error)
func (*UserSystem) GetWeiboUser ¶
func (u *UserSystem) GetWeiboUser(openId string) (appgo.Id, error)
func (*UserSystem) GetWeixinUser ¶
func (u *UserSystem) GetWeixinUser(unionId string) (appgo.Id, error)
func (*UserSystem) HasMobileUser ¶
func (u *UserSystem) HasMobileUser(mobile string) (bool, error)
func (*UserSystem) ListUsers ¶
func (u *UserSystem) ListUsers(offset, limit int) ([]*UserData, error)
func (*UserSystem) Search ¶
func (u *UserSystem) Search(keyword string, limit int) ([]*UserData, error)
func (*UserSystem) SetMobileForUser ¶
func (u *UserSystem) SetMobileForUser(mobile string, userId appgo.Id) error
func (*UserSystem) SetPushToken ¶
func (*UserSystem) UpdateAppToken ¶
func (*UserSystem) UpdatePushInfo ¶
func (*UserSystem) UpdatePwByMobile ¶
func (u *UserSystem) UpdatePwByMobile(mobile, password string) error
func (*UserSystem) UpdateUser ¶
func (*UserSystem) UserCount ¶
func (u *UserSystem) UserCount() (int, error)
type UserSystemSettings ¶
type UserSystemSettings struct { TableName string Pushers []appgo.Pusher MobileMsgSender appgo.MobileMsgSender KvStore appgo.KvStore OnCreated OnCreatedCallback OAuths []UserDataFromOAuthCode }
Click to show internal directories.
Click to hide internal directories.