handlers

package
v0.0.0-...-45d5ef5 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidDonation = "invalid donation payload"
	ForwardingError = "error forwarding data donation"
)

define error messages

View Source
const PostalCodeRegExp = "^(0[1-9]\\d{3}|[1-9]\\d{4})$"

Variables

This section is empty.

Functions

func AddToContext

func AddToContext(name contextKey, value string) func(next http.Handler) http.Handler

AddToContext adds a variable to the request context

func ValidateDonation

func ValidateDonation(donation *DonationRequest) error

func WriteHTTPCode

func WriteHTTPCode(w http.ResponseWriter, code int)

WriteHTTPCode writes given HTTP Code to the HTTP response

func WriteHTTPErrorCode

func WriteHTTPErrorCode(w http.ResponseWriter, err error, code int)

WriteHTTPErrorCode writes given HTTP Code to the HTTP response and provides explanation - for errors

Types

type ChecksHandler

type ChecksHandler struct {
}

ChecksHandler is the handler responsible for k8s checks

func NewChecksHandler

func NewChecksHandler() *ChecksHandler

NewChecksHandler initializes a new handler

func (*ChecksHandler) Liveness

func (e *ChecksHandler) Liveness(w http.ResponseWriter, r *http.Request)

Liveness is a check that describes if the application has started

func (*ChecksHandler) Readiness

func (e *ChecksHandler) Readiness(w http.ResponseWriter, r *http.Request)

Readiness is a check if application can handle requests

func (*ChecksHandler) Routes

func (e *ChecksHandler) Routes() *chi.Mux

Routes returns the routes for the ChecksHandler

type DonationHandler

type DonationHandler struct {
}

DonationHandler is the handler responsible for Account operations

func NewDonationHandler

func NewDonationHandler() *DonationHandler

NewDonationHandler initializes a new handler

func (*DonationHandler) CreateDonation

func (e *DonationHandler) CreateDonation(w http.ResponseWriter, r *http.Request)

func (*DonationHandler) Routes

func (e *DonationHandler) Routes() *chi.Mux

Routes returns the routes for the DonationHandler

type DonationRequest

type DonationRequest struct {
	PostalCode string `json:"postalCode"`
	RiskCase   int    `json:"riskCase"`
}

DonationRequest represents the payload for a data donation

Jump to

Keyboard shortcuts

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