responses

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	*response.Service `json:"-"`
	Code              int    `json:"code"`
	Msg               string `json:"msg"`
	Data              any    `json:"data"`
	Token             string `json:"token"`
}

Response 非 HTML 请求的成功响应体

func (*Response) Accepted

func (r *Response) Accepted(args ...any) services.Response

Accepted 202 已接受, 正在处理

func (*Response) Created

func (r *Response) Created(args ...any) services.Response

Created 201 创建了新资源, POST Create 方法使用

func (*Response) Get

func (r *Response) Get(field string) (any, error)

Get 获取内容

func (*Response) New

func (r *Response) New(code int, args ...any) services.Response

New 创建新响应

func (*Response) NoContent

func (r *Response) NoContent(args ...any) services.Response

NoContent 204 成功处理, 通常在 DELETE 请求成功后使用.

func (*Response) NonAuthoritative

func (r *Response) NonAuthoritative(args ...any) services.Response

NonAuthoritative 203 非权威的第三方数据

func (*Response) Ok

func (r *Response) Ok(args ...any) services.Response

Ok 200 成功, 通用

func (*Response) ResetContent

func (r *Response) ResetContent(args ...any) services.Response

ResetContent 205 成功处理请求, 但需要客户端重置页面上的表单.

func (*Response) Set

func (r *Response) Set(arg any) services.Response

Set 设置响应体内容, 不设置 Code, 默认就是 0, 表示成功

Jump to

Keyboard shortcuts

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