MCPcopy
hub / github.com/benbjohnson/wtf / UserFromContext

Function UserFromContext

context.go:30–33  ·  view source on GitHub ↗

UserFromContext returns the current logged in user.

(ctx context.Context)

Source from the content-addressed store, hash-verified

28
29// UserFromContext returns the current logged in user.
30func UserFromContext(ctx context.Context) *User {
31 user, _ := ctx.Value(userContextKey).(*User)
32 return user
33}
34
35// UserIDFromContext is a helper function that returns the ID of the current
36// logged in user. Returns zero if no user is logged in.

Callers 4

newRequestMethod · 0.92
MustNewRequestMethod · 0.92
rollbarReportErrorFunction · 0.92
UserIDFromContextFunction · 0.85

Calls 1

ValueMethod · 0.80

Tested by 1

MustNewRequestMethod · 0.74