responses

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Streamer

func Streamer[T any](generator func(yield func(T) error) error) <-chan []byte

Types

type CustomResponseWriter

type CustomResponseWriter struct {
	http.ResponseWriter
	StatusCode int
	Size       int
}

func NewCustomResponseWriter

func NewCustomResponseWriter(w http.ResponseWriter) *CustomResponseWriter

func (*CustomResponseWriter) Flush

func (cwr *CustomResponseWriter) Flush()

func (*CustomResponseWriter) Hijack

func (cwr *CustomResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (*CustomResponseWriter) Push

func (cwr *CustomResponseWriter) Push(target string, opts *http.PushOptions) error

func (*CustomResponseWriter) Write

func (cwr *CustomResponseWriter) Write(b []byte) (int, error)

func (*CustomResponseWriter) WriteHeader

func (w *CustomResponseWriter) WriteHeader(statusCode int)

func (*CustomResponseWriter) Written

func (cwr *CustomResponseWriter) Written() bool

type IActionResult

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

func Accepted

func Accepted(content interface{}) *IActionResult

func BadRequest

func BadRequest(content interface{}) *IActionResult

func Conflict

func Conflict(content interface{}) *IActionResult

func Created

func Created(content interface{}) *IActionResult

func CreatedAt

func CreatedAt(url string, content interface{}) *IActionResult

func File

func File(content []byte, filename string) *IActionResult

func Forbidden

func Forbidden(content interface{}) *IActionResult

func Found

func Found(url string) *IActionResult

func Html

func Html(content interface{}) *IActionResult

func InternalServerError

func InternalServerError(content interface{}) *IActionResult

func MovedPermanently

func MovedPermanently(url string) *IActionResult

func NoContent

func NoContent() *IActionResult

func NotFound

func NotFound(content interface{}) *IActionResult

func NotImplemented

func NotImplemented(content interface{}) *IActionResult

func NotModified

func NotModified() *IActionResult

func Ok

func Ok(content interface{}) *IActionResult

func PartialContent

func PartialContent(content []byte) *IActionResult

func Problem

func Problem(detail string) *IActionResult

func Response

func Response(statusCode int, content interface{}) *IActionResult

func ServiceUnavailable

func ServiceUnavailable(content interface{}) *IActionResult

func Streaming

func Streaming(mt types.MediaType, stream <-chan []byte) *IActionResult

func Template

func Template(dir, file string, data interface{}) *IActionResult

func Throw

func Throw(statusCode int, content interface{}) *IActionResult

func Unauthorized

func Unauthorized(content interface{}) *IActionResult

func UnprocessableEntity

func UnprocessableEntity(errors interface{}) *IActionResult

func ValidationProblem

func ValidationProblem(errors map[string]string) *IActionResult

func (*IActionResult) MtType

func (a *IActionResult) MtType(mt types.MediaType) *IActionResult

func (*IActionResult) SetCrumb

func (a *IActionResult) SetCrumb(cookie *http.Cookie) *IActionResult

func (*IActionResult) SetHeader

func (a *IActionResult) SetHeader(key, value string) *IActionResult

type ResponseWriter

type ResponseWriter struct {
	W          http.ResponseWriter
	StatusCode int
	MediaType  types.MediaType
	// contains filtered or unexported fields
}

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) Send

func (rw *ResponseWriter) Send(v interface{})

func (*ResponseWriter) SetStatusCode

func (rw *ResponseWriter) SetStatusCode(statusCode int)

type StreamingResponse

type StreamingResponse struct {
	Stream <-chan []byte
}

type TemplateResponse

type TemplateResponse struct {
	Template *template.Template
	Data     interface{}
}

Jump to

Keyboard shortcuts

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