response

package
v0.0.0-...-b8189d2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON[Req any, Res any](ctx context.Context, c *app.RequestContext, handler JSONHandler[Req, Res])

func JSONError

func JSONError(c *app.RequestContext, err error)

func JSONSuccess

func JSONSuccess(c *app.RequestContext, data interface{})

Types

type JSONHandler

type JSONHandler[Req any, Res any] func(c *biz_context.BizContext, req *Req) (*Res, error)

type Result

type Result struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

func NewResultFromError

func NewResultFromError(err error) *Result

func NewResultWithData

func NewResultWithData(data any) *Result

Jump to

Keyboard shortcuts

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