func (c *UserController) Users() { userId, _ := c.GetInt(":id") var user, err = models.User(userId) if err != nil { c.Data["json"] = nil } else { c.Data["json"] = user } c.ServeJson() }
func TestGetUsers(t *testing.T) { fmt.Println("*************************") var users = models.User(1) fmt.Println("users", users[1]) for _, user := range users { fmt.Println(user) } }