1234567891011121314151617181920212223242526272829 |
- package context
- import (
- "gopkg.in/macaron.v1"
- "gogs.io/gogs/internal/db"
- )
- type ParamsUser struct {
- *db.User
- }
- func InjectParamsUser() macaron.Handler {
- return func(c *Context) {
- user, err := db.GetUserByName(c.Params(":username"))
- if err != nil {
- c.NotFoundOrError(err, "get user by name")
- return
- }
- c.Map(&ParamsUser{user})
- }
- }
|