common

package
v0.0.0-...-0f5609b Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadFormat        = fmt.Errorf("invalid format")
	ErrUnresolvableHost = fmt.Errorf("unresolvable host")
)
View Source
var DB *gorm.DB

Functions

func DialTimeout

func DialTimeout(addr string, timeout time.Duration) (*smtp.Client, error)

func GenerateToken

func GenerateToken(mapClaims jwt.Claims) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

func ValidateFormat

func ValidateFormat(email string) error

func ValidateHost

func ValidateHost(email string) error

func ValidatePassword

func ValidatePassword(hashedPassword, password string) bool

func ValidateToken

func ValidateToken(tokenString string) (jwt.MapClaims, error)

Types

type Configuration

type Configuration struct {
	DB         *Database
	Credential *Credential
	JWT        *JWT
	Port, Mode string
}
var Config *Configuration

type Credential

type Credential struct {
	Username,
	Email,
	Password string
}

type Database

type Database struct {
	Host,
	Name,
	User,
	Password string
}

type JWT

type JWT struct {
	Secret string
}

type SmtpError

type SmtpError struct {
	Err error
}

func NewSmtpError

func NewSmtpError(err error) SmtpError

func (SmtpError) Code

func (e SmtpError) Code() string

func (SmtpError) Error

func (e SmtpError) Error() string

Jump to

Keyboard shortcuts

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