ginruntime

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET = iota
	POST
	PUT
	PATCH
	DELETE
)

Exporting constants to avoid hardcoding these all over, and ending up with a uppercase "POST" bug in the future.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

Types

type ApiError

type ApiError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Details error  `json:"-"`
}

func (ApiError) Error

func (appError ApiError) Error() string

type DbError

type DbError struct {
	Code int   `json:"code"`
	Err  error `json:"message"`
}

func (DbError) Error

func (dbError DbError) Error() string

type GinEngine

type GinEngine struct {
	// contains filtered or unexported fields
}

func NewGinEngine

func NewGinEngine() *GinEngine

func (*GinEngine) AddRoute

func (e *GinEngine) AddRoute(group *gin.RouterGroup, path string, method int, handlers ...gin.HandlerFunc)

AddRoute Add a new endpoint mapping

func (*GinEngine) NewGroup

func (e *GinEngine) NewGroup(path string, handlers ...gin.HandlerFunc) *gin.RouterGroup

func (*GinEngine) ServerHttp

func (e *GinEngine) ServerHttp(recorder *httptest.ResponseRecorder, request *http.Request)

Used for unit testing

func (*GinEngine) StartServer

func (e *GinEngine) StartServer(ctx context.Context)

type UnauthorizedError

type UnauthorizedError struct {
}

func (UnauthorizedError) Error

func (unauthorized UnauthorizedError) Error() string

Jump to

Keyboard shortcuts

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