shared

package
v0.0.0-...-1fa52ee Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0, BSD-2-Clause, ISC, + 1 more Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BadRequestBody = "bad request body format"

Variables

This section is empty.

Functions

func ApiOutputAbort

func ApiOutputAbort(c *gin.Context, err error)

ApiOutputAbort writes the HTTP response code header and saves the error internally, but doesn't push it to the response

func ApiOutputError

func ApiOutputError(c *gin.Context, err error)

ApiOutputError writes a JSON error message to the HTTP response body

func ApiOutputSuccess

func ApiOutputSuccess(c *gin.Context, body interface{}, status int)

ApiOutputSuccess writes a JSON success message to the HTTP response body

func GetUser

func GetUser(c *gin.Context) (*common.User, bool)

Types

type ApiBody

type ApiBody TypedApiBody[interface{}]

type ResponsePipelines

type ResponsePipelines struct {
	Count     int64              `json:"count"`
	Pipelines []*models.Pipeline `json:"pipelines"`
}

type TypedApiBody

type TypedApiBody[T any] struct {
	Success bool     `json:"success"`
	Message string   `json:"message"`
	Causes  []string `json:"causes"`
	Data    T        `json:"data"`
}

Jump to

Keyboard shortcuts

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