controller

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 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 ListUserResponse added in v1.4.0

type ListUserResponse struct {
	at.ResponseBody `json:"-"`
	model.BaseResponse
	Data *UserRequests `json:"data"`
}

type User

type User struct {
	ID       int    `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type UserController

type UserController struct {
	at.RestController

	at.RequestMapping `value:"/user" `
}

func (*UserController) DeleteUser

func (c *UserController) DeleteUser(_ struct {
	at.DeleteMapping `value:"/{id}"`
	at.Operation     `id:"Update Employee" description:"Delete User by ID"`
}, id int) (response *UserResponse)

GetUser

func (*UserController) GetUser

func (c *UserController) GetUser(_ struct {
	at.GetMapping `value:"/{id}"`
	at.Operation  `id:"Update Employee" description:"Get User by ID"`
	// /user/{id} -> `values:"user:read" type:"path" in:"id"`
	at.RequiresPermissions `values:"user:read" type:"path" in:"id"`
}, id int, ctx context.Context) (response *UserResponse)

GetUser

func (*UserController) GetUserByName added in v1.4.0

func (c *UserController) GetUserByName(_ struct {
	at.GetMapping `value:"/name/{name}"`
	// /user/{id} -> `values:"user:read" type:"path" in:"id"`
	at.RequiresPermissions `values:"user:read" type:"path" in:"name"`
}, name string) (response *UserResponse)

GetUser

func (*UserController) GetUserQuery added in v1.4.0

func (c *UserController) GetUserQuery(_ struct {
	at.GetMapping `value:"/query"`
	at.Operation  `id:"Update Employee" description:"Query User"`
	// /user?id=12345 -> `values:"user:read" type:"query" in:"id"`
	at.RequiresPermissions `values:"user:read" type:"query" in:"id"`
}, ctx context.Context) (response *UserResponse)

GetUser

func (*UserController) GetUsers added in v1.4.0

func (c *UserController) GetUsers(_ struct {
	at.GetMapping          `value:"/"`
	at.Operation           `id:"Update Employee" description:"Get User List"`
	at.RequiresPermissions `values:"user:list" type:"query:pagination" in:"page,per_page,id" out:"expr,total"`
}, request *UserRequests, ctx context.Context) (response *ListUserResponse)

GetUser

type UserRequests added in v1.4.0

type UserRequests struct {
	at.RequestParams
	at.Schema

	// For paginated result sets, page of results to retrieve.
	Page int `url:"page,omitempty" json:"page,omitempty" validate:"min=1"`

	// For paginated result sets, the number of results to include per page.
	PerPage int `url:"per_page,omitempty" json:"per_page,omitempty" validate:"min=1"`

	Total int `json:"total"`

	Expr string `json:"expr"`
}

type UserResponse

type UserResponse struct {
	at.ResponseBody `json:"-"`
	model.BaseResponse
	Data *User `json:"data"`
}

Jump to

Keyboard shortcuts

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