handlers

package
v0.0.0-...-2bbbb8e Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyUser

type KeyUser struct{}

KeyUser is a key used for the User object inside context

type UsersHandler

type UsersHandler struct {
	// contains filtered or unexported fields
}

UsersHandler contains the items common to all user handler functions

func NewUsersHandler

func NewUsersHandler(db database.UserDB) *UsersHandler

NewUsersHandler creates a user handler with the given logger

func (*UsersHandler) AddUser

func (userHandler *UsersHandler) AddUser(responseWriter http.ResponseWriter, request *http.Request)

AddUser creates a new user from the received JSON

func (*UsersHandler) Delete

func (userHandler *UsersHandler) Delete(responseWriter http.ResponseWriter, request *http.Request)

Delete a user with specified id from the database

func (*UsersHandler) GetUserByID

func (userHandler *UsersHandler) GetUserByID(responseWriter http.ResponseWriter, request *http.Request)

GetUserByID returns a single user from the database

func (*UsersHandler) GetUserByUsername

func (userHandler *UsersHandler) GetUserByUsername(responseWriter http.ResponseWriter, request *http.Request)

GetUserByUsername returns a single user from the database

func (*UsersHandler) GetUsers

func (userHandler *UsersHandler) GetUsers(responseWriter http.ResponseWriter, request *http.Request)

GetUsers returns the full list of users

func (*UsersHandler) LivenessCheck

func (userHandler *UsersHandler) LivenessCheck(responseWriter http.ResponseWriter, request *http.Request)

LivenessCheck determine when the application needs to be restarted

func (*UsersHandler) MiddlewareUserValidation

func (userHandler *UsersHandler) MiddlewareUserValidation(next http.Handler) http.Handler

MiddlewareUserValidation is used to validate incoming user JSONS

func (*UsersHandler) ReadinessCheck

func (userHandler *UsersHandler) ReadinessCheck(responseWriter http.ResponseWriter, request *http.Request)

ReadinessCheck verifies that the application is ready to accept requests

func (*UsersHandler) UpdateUsers

func (userHandler *UsersHandler) UpdateUsers(responseWriter http.ResponseWriter, request *http.Request)

UpdateUsers updates the user with the ID specified in the received JSON user

Jump to

Keyboard shortcuts

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