user_auth.go
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package repository
import "opp/models"
type IUserAuthRepository interface {
GetUserAuthByUserId(uid int64) (v *models.UserAuth, err error)
UpdateUserAuthById(m *models.UserAuth) (err error)
GetUserAuthByAuthCode(authCode string) (v *models.UserAuth, err error)
GetUserAuthByRefreshToken(refreshToken string) (v *models.UserAuth, err error)
GetUserAuthByToken(refreshToken string) (v *models.UserAuth, err error)
AddUserAuth(m *models.UserAuth) (err error)
}
var _ IUserAuthRepository = (*UserAuthRepository)(nil)
type UserAuthRepository struct{}
func (r *UserAuthRepository) GetUserAuthByUserId(uid int64) (v *models.UserAuth, err error) {
return models.GetUserAuthByUserId(uid)
}
func (r *UserAuthRepository) UpdateUserAuthById(m *models.UserAuth) (err error) {
return models.UpdateUserAuthById(m)
}
func (r *UserAuthRepository) AddUserAuth(m *models.UserAuth) (err error) {
_, err = models.AddUserAuth(m)
return
}
func (r *UserAuthRepository) GetUserAuthByAuthCode(authCode string) (v *models.UserAuth, err error) {
return models.GetUserByAuthCode(authCode)
}
func (r *UserAuthRepository) GetUserAuthByRefreshToken(refreshToken string) (v *models.UserAuth, err error) {
return models.GetUserAuthByRefreshToken(refreshToken)
}
func (r *UserAuthRepository) GetUserAuthByToken(refreshToken string) (v *models.UserAuth, err error) {
return models.GetUserAuthByToken(refreshToken)
}