service

package
v0.0.0-...-70b0572 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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 CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPasswordHash func

func GenerateToken

func GenerateToken(signingKey []byte, userid, tid string, role, exp int) (string, error)

GenerateToken func

func HashPassword

func HashPassword(password string) (string, error)

HashPassword func

func New

func New(req models.UserRequest) (models.User, error)

New User

func Register

func Register(req models.UserRequest) (models.User, error)

Register func

func ValidatePassword

func ValidatePassword(password string) error

ValidatePassword func

func ValidateRegistration

func ValidateRegistration(req models.UserRequest) error

ValidateRegistration func

func ValidateUsername

func ValidateUsername(username string) error

ValidateUsername 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL