controller

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListUserResponse

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, err error)

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, err error)

GetUser

func (*UserController) GetUserByName

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, err error)

GetUser

func (*UserController) GetUserQuery

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, err error)

GetUser

func (*UserController) GetUsers

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, err error)

GetUser

type UserRequests

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