controller

package
v0.0.0-...-1441576 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorBadParams = "BadParams"

ErrorBadParams paramaters wrong

View Source
const ErrorNotAuthenticated = "NotAuthenticated"

ErrorNotAuthenticated user not authenticated

View Source
const ErrorNotAuthorized = "NotAuthorized"

ErrorNotAuthorized user not authorized

View Source
const ErrorNotFound = "NotFound"

ErrorNotFound data not found

View Source
const ErrorSessionTimeout = "SessionTimeout"

ErrorSessionTimeout user session timedout

View Source
const ErrorUnknown = "Unknown"

ErrorUnknown unknown error

Variables

This section is empty.

Functions

func ConnectFaceRecognitionRoutes

func ConnectFaceRecognitionRoutes(router *mux.Router, logger *log.Logger,
	faceServerHost string, faceServerPort int, faceRootDir string)

ConnectFaceRecognitionRoutes creates controller for face recognition

func LogError

func LogError(logger *log.Logger, err error, endpoint string)

LogError logs an error

func LogWarning

func LogWarning(logger *log.Logger, warning string, endpoint string)

LogWarning logs a warning

func WriteJSON

func WriteJSON(w http.ResponseWriter, value interface{}) error

WriteJSON returns json message to http client

func WriteJSONError

func WriteJSONError(w http.ResponseWriter, errorName string) error

WriteJSONError returns error json message to http client

func WriteJSONSuccess

func WriteJSONSuccess(w http.ResponseWriter, response interface{}) error

WriteJSONSuccess returns success json message to http client

Types

type ErrorJSON

type ErrorJSON struct {
	Success   bool   `json:"success"`
	ErrorName string `json:"error"`
}

ErrorJSON response for web service call errors

func NewErrorJSON

func NewErrorJSON(errorName string) ErrorJSON

NewErrorJSON creates ErrorJSON stuct with proper defaults

type SuccessJSON

type SuccessJSON struct {
	Success  bool        `json:"success"`
	Response interface{} `json:"response"`
}

SuccessJSON response for web service calls

func NewSuccessJSON

func NewSuccessJSON(response interface{}) SuccessJSON

NewSuccessJSON creates SuccessJSON stuct with proper defaults

Jump to

Keyboard shortcuts

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