Documentation ¶
Index ¶
Constants ¶
View Source
const ( SaltLen = 32 TokenExpire = 2 * 60 * 60 )
View Source
const ( ErrCodeInvalidParam = 1001 ErrCodeInvalidToken = 1002 ErrCodeExpiredToken = 1003 ErrCodeInvalidPassword = 1004 ErrCodeUserExists = 2001 ErrCodeUserNotExist = 2002 ErrCodeRoleExists = 2003 ErrCodeRoleNotExist = 2004 ErrCodeRoleNotMatch = 2005 ErrCodeGenToken = 3001 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Role ¶
type Role struct { RoleName string `json:"role_name,omitempty"` CreateTime int64 `json:"create_time,omitempty"` }
Role role
type RoleReq ¶
type RoleReq struct {
RoleName string `json:"role_name,omitempty"`
}
RoleReq create or delete role request
type Token ¶
type Token struct { UserName string `json:"user_name,omitempty"` Password []byte `json:"password,omitempty"` Rand string `json:"rand,omitempty"` Timestamp int64 `json:"ts,omitempty"` Expire int64 `json:"expire,omitempty"` }
Token token
type User ¶
type User struct { UserName string `json:"user_name,omitempty"` Salt []byte `json:"salt,omitempty"` Password []byte `json:"password,omitempty"` CreateTime int64 `json:"create_time,omitempty"` }
User user
func (*User) UserRolesKey ¶
UserRolesKey for searching all roles
type UserReq ¶
type UserReq struct { UserName string `json:"user_name,omitempty"` Password string `json:"password,omitempty"` }
UserReq create or delete user request
Click to show internal directories.
Click to hide internal directories.