MCPcopy Index your code
hub / github.com/gourouting/singo / CurrentUser

Function CurrentUser

api/main.go:23–30  ·  view source on GitHub ↗

CurrentUser gets the current user.

(c *gin.Context)

Source from the content-addressed store, hash-verified

21
22// CurrentUser gets the current user.
23func CurrentUser(c *gin.Context) *model.User {
24 if user, _ := c.Get("user"); user != nil {
25 if u, ok := user.(*model.User); ok {
26 return u
27 }
28 }
29 return nil
30}
31
32// ErrorResponse returns an error message.
33func ErrorResponse(err error) serializer.Response {

Callers 1

UserMeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected