model

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyReqBody added in v1.3.5

func CopyReqBody(b io.ReadCloser) (r1, r2 io.ReadCloser, err error)

borrowed from httputil unexported function drainBody

func CopyRespBody added in v1.3.5

func CopyRespBody(b *bytes.Buffer) (b1, b2 *bytes.Buffer, err error)

func GetReqBody added in v1.3.5

func GetReqBody(cp io.ReadCloser, r *http.Request) string

func GetRespBody added in v1.3.5

func GetRespBody(rec *httptest.ResponseRecorder) string

func JsonMarshalIndent added in v1.3.5

func JsonMarshalIndent(data interface{}, prefix, indent string, disableHTMLEscape bool) (string, error)

Types

type Annotation added in v1.1.7

type Annotation struct {
	Name   string
	Params []string
}

type AnnotationStore added in v1.1.7

type AnnotationStore map[string][]Annotation

func (AnnotationStore) GetParams added in v1.1.7

func (receiver AnnotationStore) GetParams(key string, annotationName string) []string

func (AnnotationStore) HasAnnotation added in v1.1.7

func (receiver AnnotationStore) HasAnnotation(key string, annotationName string) bool

type BizError added in v1.3.5

type BizError struct {
	StatusCode int
	ErrCode    int
	ErrMsg     string
	Cause      error
}

BizError is used for business error implemented error interface StatusCode will be set to http response status code ErrCode is used for business error code ErrMsg is custom error message

func NewBizError added in v1.3.5

func NewBizError(err error, opts ...BizErrorOption) BizError

NewBizError is factory function for creating an instance of BizError struct

func (BizError) Error added in v1.3.5

func (b BizError) Error() string

Error is used for implementing error interface

func (BizError) String added in v1.3.5

func (b BizError) String() string

String function is used for printing string representation of a BizError instance

type BizErrorOption added in v1.3.5

type BizErrorOption func(bizError *BizError)

func WithCause added in v1.3.5

func WithCause(cause error) BizErrorOption

func WithErrCode added in v1.3.5

func WithErrCode(errCode int) BizErrorOption

func WithStatusCode added in v1.3.5

func WithStatusCode(statusCode int) BizErrorOption

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route wraps config for route

Jump to

Keyboard shortcuts

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