engine

package
v0.0.0-...-f632af9 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOk        = 0
	StatusIntErr    = 1
	StatusErr       = 2
	StatusForbidden = 3
	StatusExists    = 4
)

http functions status

Variables

This section is empty.

Functions

func InvalidRequestParams

func InvalidRequestParams(message string) interface{}

returns struct ready for rendering with text message

Types

type AppEnvironment

type AppEnvironment interface {
	ExportUserRoutes(router *mux.Router)
	ExportEventRoutes(router *mux.Router)
	ExportProjectRoutes(router *mux.Router)
}

type Env

type Env struct {
	DBEngine    mongo.DataStore
	SigningKey  *jwtauth.JWTAuth
	AllowOrigin string
	Location    *time.Location
}

Env - core struct for storing dependencies

func NewEnv

func NewEnv(dbEngine mongo.DataStore, signingKey string, location *time.Location) *Env

NewEnv - create new env struct

func (*Env) AddUser

func (env *Env) AddUser(login, password string) (err error)

func (*Env) Authenticate

func (env *Env) Authenticate(login string, password string) (err error)

Authenticate - returns error, if user not exists or wrong password, else ok

func (*Env) ExportEventRoutes

func (env *Env) ExportEventRoutes(router *mux.Router)

func (*Env) ExportProjectRoutes

func (env *Env) ExportProjectRoutes(router *mux.Router)

func (*Env) ExportUserRoutes

func (env *Env) ExportUserRoutes(router *mux.Router)

func (*Env) JWTMiddleware

func (env *Env) JWTMiddleware(next http.Handler) http.Handler

type Resp

type Resp struct {
	Status   int
	JsonBody []byte
	Logger   log.Logger
}

struct for http response

func (*Resp) Render

func (r *Resp) Render(w http.ResponseWriter)

just render JSON response from struct Resp

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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