Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryConverter ¶
type BinaryConverter struct {
// contains filtered or unexported fields
}
func (*BinaryConverter) Deserialize ¶
func (*BinaryConverter) Type ¶
func (receiver *BinaryConverter) Type() *gotrac.HandlerType
type Converter ¶
type EmptyConverter ¶
type EmptyConverter struct{}
func (EmptyConverter) Deserialize ¶
func (EmptyConverter) Type ¶
func (e EmptyConverter) Type() *gotrac.HandlerType
type HandlerFunc ¶
type HandlerFunc[TInput any, TOutput any] func(request *Request[TInput], writer HeaderWriter) (*TOutput, error)
type HandlerWithConversion ¶
type HandlerWithConversion interface { gotrac.Handler WithSummary(summary string) HandlerWithConversion WithDescription(description string) HandlerWithConversion WithHidden(hidden bool) HandlerWithConversion }
func WithConversion ¶
func WithConversion[TInput any, TOutput any](input Converter[TInput], output Converter[TOutput], h HandlerFunc[TInput, TOutput]) HandlerWithConversion
type HeaderWriter ¶
type HeaderWriter interface { // Header returns the header map that will be sent by // [ResponseWriter.WriteHeader]. The [Header] map also is the mechanism with which // [Handler] implementations can set HTTP trailers. // // Changing the header map after a call to [ResponseWriter.WriteHeader] (or // [ResponseWriter.Write]) has no effect unless the HTTP status code was of the // 1xx class or the modified headers are trailers. // // There are two ways to set Trailers. The preferred way is to // predeclare in the headers which trailers you will later // send by setting the "Trailer" header to the names of the // trailer keys which will come later. In This case, those // keys of the Header map are treated as if they were // trailers. See the example. The second way, for trailer // keys not known to the [Handler] until after the first [ResponseWriter.Write], // is to prefix the [Header] map keys with the [TrailerPrefix] // constant value. // // To suppress automatic response headers (such as "Date"), set // their value to nil. Header() http.Header // WriteHeader sends an HTTP response header with the provided // status code. // // If WriteHeader is not called explicitly, the first call to Write // will trigger an implicit WriteHeader(gocart.StatusOK). // Thus explicit calls to WriteHeader are mainly used to // send error codes or 1xx informational responses. // // The provided code must be a valid HTTP 1xx-5xx status code. // Any number of 1xx headers may be written, followed by at most // one 2xx-5xx header. 1xx headers are sent immediately, but 2xx-5xx // headers may be buffered. Use the Flusher interface to send // buffered data. The header map is cleared when 2xx-5xx headers are // sent, but not with 1xx headers. // // The server will automatically send a 100 (Continue) header // on the first read from the request body if the request has // an "Expect: 100-continue" header. WriteHeader(statusCode int) }
type JsonConverter ¶
type JsonConverter[T any] struct { }
func (JsonConverter[T]) Deserialize ¶
func (j JsonConverter[T]) Deserialize(data []byte, headers http.Header) (*T, error)
func (JsonConverter[T]) Serialize ¶
func (j JsonConverter[T]) Serialize(body *T, headers http.Header) ([]byte, error)
func (JsonConverter[T]) Type ¶
func (j JsonConverter[T]) Type() *gotrac.HandlerType
Click to show internal directories.
Click to hide internal directories.