Documentation ¶
Index ¶
- Constants
- func CheckPasswordHash(password, hash string) bool
- func GenerateToken(signingKey []byte, userid, tid string, role, exp int) (string, error)
- func HashPassword(password string) (string, error)
- func New(req models.UserRequest) (models.User, error)
- func Register(req models.UserRequest) (models.User, error)
- func ValidatePassword(password string) error
- func ValidateRegistration(req models.UserRequest) error
- func ValidateUsername(username string) error
- type AuthService
- type UserService
Constants ¶
View Source
const ( DefaultPass = "DEFAULTPASS" MinPassLength = 6 MinUsernameLength = 5 MaxUsernameLength = 40 )
DefaultPass const
View Source
const (
TokenSecret = "TOKENSECRET"
)
TokenSecret const
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
GenerateToken func
func ValidateRegistration ¶
func ValidateRegistration(req models.UserRequest) error
ValidateRegistration func
Types ¶
type AuthService ¶
type AuthService interface { Register(ctx context.Context, req models.UserRequest) (string, error) Login(ctx context.Context, req models.LoginRequest) (interface{}, error) RegMail(ctx context.Context, req models.UserRequest) (interface{}, error) }
AuthService interface declaration
func NewAuthService ¶
func NewAuthService( a repo.UserRepo, ) AuthService
NewAuthService function declaration
type UserService ¶
type UserService interface { Create(ctx context.Context, req models.UserRequest) (string, error) Update(ctx context.Context, req models.User) (string, error) Search(ctx context.Context, req models.UserSearchRequest) (interface{}, error) Get(ctx context.Context, req models.IDRequest) (interface{}, error) Delete(ctx context.Context, req models.IDRequest) (string, error) Find(ctx context.Context, req models.UserFindRequest) (models.User, error) }
UserService type interface declaration
func NewUserService ¶
func NewUserService( a repo.UserRepo, ) UserService
NewUserService function declaration
Click to show internal directories.
Click to hide internal directories.