core

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package core implements some core functions used by apimachinery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteResponse

func WriteResponse(c *gin.Context, err error, data interface{})

WriteResponse write an error or the response data into http response body. It use errors.ParseCoder to parse any error into errors.Coder errors.Coder contains error code, user-safe error message and http status code.

Types

type ErrResponse

type ErrResponse struct {
	// Namespace defines the namespace of this error.
	Namespace string `json:"namespace"`

	// Code defines the business error code.
	Code int `json:"code"`

	// Message contains the detail of this message.
	// This message is suitable to be exposed to external
	Message string `json:"message"`

	// Reference returns the reference document which maybe useful to solve this error.
	Reference string `json:"reference,omitempty"`
}

ErrResponse defines the return messages when an error occurred. Reference will be omitted if it does not exist. swagger:model

Jump to

Keyboard shortcuts

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