response

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyBodyResponse

type EmptyBodyResponse struct{} // @name EmptyBodyResponse

type Result

type Result[T any] struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
	Data    T      `json:"data"`

} // @name JSONResponse

func Fail

func Fail(code int, message string) *Result[any]

func Ok

func Ok[T any](message string, data T) *Result[T]

func OkByData

func OkByData[T any](data T) *Result[T]

func OkByMessage

func OkByMessage(message string) *Result[any]

type ValidationErrorDetail

type ValidationErrorDetail struct {
	Rule    string `json:"rule"`
	Message string `json:"message"`
}

type ValidationErrorResponse

type ValidationErrorResponse struct {
	Message string                             `json:"message"`
	Errors  map[string][]ValidationErrorDetail `json:"errors"`
}

func ValidationError

func ValidationError(message string, errors map[string][]ValidationErrorDetail) ValidationErrorResponse

Jump to

Keyboard shortcuts

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