-
Notifications
You must be signed in to change notification settings - Fork 0
/
struct.go
48 lines (43 loc) · 1.04 KB
/
struct.go
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
42
43
44
45
46
47
48
package userutil
import (
"errors"
"github.com/golang-jwt/jwt/v4"
)
//type User struct {
// Username string
// Password string
// Email string
// RegTime int64
// RegIp string
// LastTime int64
// LastIp string
//}
//
//type UserLastInfo struct {
// LastIp string
// LastTime int64
//}
type JwtClaims struct {
ID string `json:"jti,omitempty"`
ExpireAt int64 `json:"exp,omitempty"`
IssuedAt int64 `json:"iat,omitempty"`
Issuer string `json:"iss,omitempty"`
Username string `json:"username"`
UserId int `json:"userId"`
Email string `json:"email"`
LastTime int64 `json:"lastTime"`
jwt.RegisteredClaims
}
type UserInfo struct {
Username string `json:"username"`
UserId int `json:"userId"`
Email string `json:"email"`
LastTime int64 `json:"lastTime"`
}
var (
ErrEmailExists = errors.New("mailExists")
ErrUsernameExists = errors.New("usernameExists")
ErrPasswd = errors.New("password not correct")
ErrDatabase = errors.New("database error")
ErrJwtExpired = errors.New("jwt is expired")
)