common

package
v0.0.0-...-d6725e5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapHandler

func WrapHandler(handler func(*Context)) gin.HandlerFunc

Types

type BadRequestResponse

type BadRequestResponse struct {
	Code int    `json:"code" default:"400"`
	Body string `json:"body"`
}

type Context

type Context struct {
	*gin.Context
	User     *generate.User
	IsAuthed bool
	Timing   *serverTiming.Timing
}

func (*Context) JSONError

func (c *Context) JSONError(code int, err error)

func (*Context) JSONResult

func (c *Context) JSONResult(value any)

type InternalServerErrorResponse

type InternalServerErrorResponse struct {
	Code int    `json:"code" default:"500"`
	Body string `json:"body"`
}

type NotFoundResponse

type NotFoundResponse struct {
	Code int    `json:"code" default:"404"`
	Body string `json:"body"`
}

type Response

type Response[T any] struct {
	Code int `json:"code" default:"200"`
	Body T   `json:"body"`
}

type UnauthorizedResponse

type UnauthorizedResponse struct {
	Code int    `json:"code" default:"401"`
	Body string `json:"body"`
}

Jump to

Keyboard shortcuts

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