helpers

package
v0.0.0-...-a131ce6 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextGetUser

func ContextGetUser(r *http.Request) *domain.User

ContextSetUser retrieves the User struct from the request context. The only time that we'll use this helper is when we logically expect there to be User struct value in the context, and if it doesn't exist it will firmly be an 'unexpected' error. As we discussed earlier in the book, it's OK to panic in those circumstances.

func ContextSetUser

func ContextSetUser(r *http.Request, user *domain.User) *http.Request

ContextSetUser returns a new copy of the request with the provided User struct added to the context. Note that we use our userContextKey constant as the key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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