helpers

package
v0.0.0-...-f20b4aa Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2017 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GeneralErrorInternal = MakeError("An error has aoccured")

	AuthenticationErrorRegisterNoEmail            = MakeError("Email is empty")
	AuthenticationErrorRegisterNoPassword         = MakeError("Password is empty")
	AuthenticationErrorRegisterPasswordNotValid   = MakeError("Password not acceptable")
	AuthenticationErrorRegisterUserCreationFailed = MakeError("Could not create new user")
	AuthenticationErrorLoginAlreadyAuthenticated  = MakeError("User is already authenticated")
	AuthenticationErrorLoginWrongEmailPassword    = MakeError("Wrong email and/or password")
	AuthenticationErrorLoginUserNotExists         = MakeError("Email doesn't exist")
	AuthenticationErrorAuthorizeNewSession        = MakeError("new authorization session")
	AuthenticationErrorAuthorizeUserNotLoggedIn   = MakeError("user not logged in")
	AuthenticationErrorConfirmationTokenNotValid  = MakeError("Confirmation token is not valid")

	EventsErrorNotFound = MakeError("Event not found")

	SlotsErrorNotFound = MakeError("Slot not found")
)

Functions

func CreateToken

func CreateToken() (string, error)

func GetCurrentUser

func GetCurrentUser(r *http.Request) models.User

GetMyKey returns a value for this package from the request values.

func JsonResponse

func JsonResponse(writer http.ResponseWriter, statusCode int, responseObject interface{})

func MakeError

func MakeError(msg string) error

func RandStringBytesMaskImprSrc

func RandStringBytesMaskImprSrc(n int) string

func SetCurrentUser

func SetCurrentUser(r *http.Request, val models.User)

SetMyKey sets a value for this package in the request values.

Types

type GeneralResponse

type GeneralResponse struct {
	Success bool                   `json:"success"`
	Message string                 `json:"message,omitempty"`
	Data    map[string]interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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