utils

package
v0.0.0-...-e3a0aff Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenInvalid   = errors.New("token invalid")
	ErrTokenIsExpired = errors.New("token is expired")
)

Functions

func DecodeRequestBody

func DecodeRequestBody(w http.ResponseWriter, r *http.Request, t interface{})

func GenerateAdminToken

func GenerateAdminToken(user *db.Admin, expiresAt int64) (token string, err error)

func GeneratePatientToken

func GeneratePatientToken(user *db.Patient, expiresAt int64) (token string, err error)

func GenerateToken

func GenerateToken(user *db.Psychologist, expiresAt int64) (token string, err error)

func GetTokenFromHeader

func GetTokenFromHeader(h http.Header) string

func HashPassword

func HashPassword(pass string, w http.ResponseWriter) string

func ParseTokenWithClaims

func ParseTokenWithClaims(tokenString string) (*db.CustomClaims, error)

func SendEmail

func SendEmail(dbase *gorm.DB, email string, subject string, HTMLtemp string, body interface{}) error

func UploadFile

func UploadFile(w http.ResponseWriter, r *http.Request)

Types

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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