Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...Option) gin.HandlerFunc
New wraps a handler and aborts the process of the handler if the timeout is reached
Types ¶
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool represents a pool of buffers.
func (*BufferPool) Get ¶
func (p *BufferPool) Get() *bytes.Buffer
Get returns a buffer from the buffer pool. If the pool is empty, a new buffer is created and returned.
func (*BufferPool) Put ¶
func (p *BufferPool) Put(buf *bytes.Buffer)
Put adds a buffer back to the pool.
type Writer ¶
type Writer struct { gin.ResponseWriter // contains filtered or unexported fields }
Writer is a writer with memory buffer
func NewWriter ¶
func NewWriter(w gin.ResponseWriter, buf *bytes.Buffer) *Writer
NewWriter will return a timeout.Writer pointer
func (*Writer) Status ¶
Status we must override Status func here, or the http status code returned by gin.Context.Writer.Status() will always be 200 in other custom gin middlewares.
func (*Writer) Write ¶
Write will write data to response body
func (*Writer) WriteHeader ¶
WriteHeader sends an HTTP response header with the provided status code. If the response writer has already written headers or if a timeout has occurred, this method does nothing.