rest

package
v0.0.13-dev Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle[T, E any](fn Function[T, E]) http.Handler

Types

type BodyBuilder

type BodyBuilder[R any] struct {
	// contains filtered or unexported fields
}

func (BodyBuilder[R]) Body

func (b BodyBuilder[R]) Body(body R) BodyBuilder[R]

func (BodyBuilder[R]) ContentType

func (b BodyBuilder[R]) ContentType(contentType string) BodyBuilder[R]

func (BodyBuilder[R]) Header

func (b BodyBuilder[R]) Header(headerName string, headerValues ...string) BodyBuilder[R]

func (BodyBuilder[R]) Headers

func (b BodyBuilder[R]) Headers(headers http.Header) BodyBuilder[R]

type Context

type Context[T, E any] struct {
	// contains filtered or unexported fields
}

func (*Context[T, E]) Accepted

func (c *Context[T, E]) Accepted() BodyBuilder[E]

func (*Context[T, E]) BadRequest

func (c *Context[T, E]) BadRequest() BodyBuilder[E]

func (*Context[T, E]) Created

func (c *Context[T, E]) Created(location string) BodyBuilder[E]

func (*Context[T, E]) Deadline

func (c *Context[T, E]) Deadline() (time.Time, bool)

func (*Context[T, E]) Done

func (c *Context[T, E]) Done() <-chan struct{}

func (*Context[T, E]) Err

func (c *Context[T, E]) Err() error

func (*Context[T, E]) Get

func (c *Context[T, E]) Get() (e E)

func (*Context[T, E]) InternalServerError

func (c *Context[T, E]) InternalServerError() BodyBuilder[E]

func (*Context[T, E]) Method

func (c *Context[T, E]) Method() string

func (*Context[T, E]) NoContent

func (c *Context[T, E]) NoContent() HeadersBuilder

func (*Context[T, E]) NotFound

func (c *Context[T, E]) NotFound() HeadersBuilder

func (*Context[T, E]) Ok

func (c *Context[T, E]) Ok() BodyBuilder[E]

func (*Context[T, E]) Path

func (c *Context[T, E]) Path() string

func (*Context[T, E]) Status

func (c *Context[T, E]) Status(status int) BodyBuilder[E]

func (*Context[T, E]) Value

func (c *Context[T, E]) Value(key any) any

type Function

type Function[T, E any] func(ctx *Context[T, E]) error

type HeadersBuilder

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

func (HeadersBuilder) Header

func (b HeadersBuilder) Header(headerName string, headerValues ...string) HeadersBuilder

func (HeadersBuilder) Headers

func (b HeadersBuilder) Headers(headers http.Header) HeadersBuilder

type ResponseEntity

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

func (ResponseEntity) Body

func (re ResponseEntity) Body() any

func (ResponseEntity) HasBody

func (re ResponseEntity) HasBody() bool

func (ResponseEntity) Headers

func (re ResponseEntity) Headers() http.Header

func (ResponseEntity) Status

func (re ResponseEntity) Status() int

type ResponseEntityHandler

type ResponseEntityHandler struct {
}

func (*ResponseEntityHandler) HandleReturnValue

func (eh *ResponseEntityHandler) HandleReturnValue(ctx http.Context, returnValue any) error

func (*ResponseEntityHandler) SupportsReturnType

func (eh *ResponseEntityHandler) SupportsReturnType(returnType reflect.Type) bool

Jump to

Keyboard shortcuts

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