timeout

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Timeout

func Timeout(opts ...Option) gin.HandlerFunc

Timeout

Types

type BufferPool

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

BufferPool is Pool of *bytes.Buffer

func (*BufferPool) Get

func (p *BufferPool) Get() *bytes.Buffer

Get a bytes.Buffer pointer

func (*BufferPool) Put

func (p *BufferPool) Put(buf *bytes.Buffer)

Put a bytes.Buffer pointer to BufferPool

type CallBackFunc

type CallBackFunc func(*http.Request)

type Option

type Option func(*Options)

Option for timeout

func WithCallBack

func WithCallBack(f CallBackFunc) Option

Optional parameters

func WithDefaultMsg

func WithDefaultMsg(s string) Option

Optional parameters

func WithErrorHandler

func WithErrorHandler(f gin.HandlerFunc) Option

Optional parameters

func WithErrorHttpCode

func WithErrorHttpCode(code int) Option

Optional parameters

func WithHandler

func WithHandler(f gin.HandlerFunc) Option

WithHandler set handle process

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout set timeout

type Options

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

Options struct

func NewDefaultOptions

func NewDefaultOptions() Options

type Writer

type Writer struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

Writer is a writer with memory buffer

func NewWriter

func NewWriter(buf *bytes.Buffer) *Writer

NewWriter will return a timeout.Writer pointer

func (*Writer) FreeBuffer

func (w *Writer) FreeBuffer()

FreeBuffer will release buffer pointer

func (*Writer) Header

func (w *Writer) Header() http.Header

Header will get response headers

func (*Writer) Write

func (w *Writer) Write(data []byte) (int, error)

Write will write data to response body

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(code int)

WriteHeader will write http status code

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (int, error)

WriteString will write string to response body

Jump to

Keyboard shortcuts

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