encode

package
v0.0.0-...-b804f52 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessCode = 0 // 成功返回码
)

Variables

View Source
var (
	HealthError = xerrors.New(500, "invalid health")

	DataExistsError = xerrors.New(1010001, "已存在")

	ErrAesKeyLengthSixteen = xerrors.New(1020001, "a sixteen or twenty-four or thirty-two length secret key is required")
	ErrAesIv               = xerrors.New(1020002, "a sixteen-length ivAes is required")
	ErrAesPaddingSize      = xerrors.New(1020003, "padding size error please check the secret key or iv")
)

Functions

func DecodeNullRequest

func DecodeNullRequest(_ context.Context, _ *http.Request) (interface{}, error)

func JsonError

func JsonError(_ context.Context, err error, w http.ResponseWriter)

func JsonResponse

func JsonResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)

Types

type Failer

type Failer interface {
	Failed() error
}

type Response

type Response struct {
	Code    int64       `json:"code"`
	Data    interface{} `json:"data,omitempty"`
	Msg     string      `json:"msg,omitempty"`
	Message string      `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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