controller

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserController

type UserController struct {
	web.Controller
	// contains filtered or unexported fields
}

RestController

func (*UserController) DeleteById

func (c *UserController) DeleteById(id uint64) (response model.Response, err error)

Delete /user/{id}

func (*UserController) GetById

func (c *UserController) GetById(id uint64) (response model.Response, err error)

Get /user/{id}

func (*UserController) Init

func (c *UserController) Init(userService service.UserService)

Init inject userService automatically

func (*UserController) Post

func (c *UserController) Post(request *UserRequest) (model.Response, error)

Post /user

type UserRequest

type UserRequest struct {
	model.RequestBody
	Id       uint64 `json:"id"`
	Name     string `json:"name" validate:"required"`
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
	Email    string `json:"email" validate:"required,email"`
	Age      uint   `json:"age" validate:"gte=0,lte=130"`
	Gender   uint   `json:"gender" validate:"gte=0,lte=2"`
}

Jump to

Keyboard shortcuts

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