testutil

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpHandlerInOut

func HttpHandlerInOut[In, Out any](m Marshaller[Out], u Unmarshaller[In], handler func(r *http.Request, in In) (int, Out)) http.Handler

func HttpHandlerOut

func HttpHandlerOut[Out any](m Marshaller[Out], handler func(r *http.Request) (int, Out)) http.Handler

func JsonHandlerInOut

func JsonHandlerInOut[In, Out any](handler func(r *http.Request, in In) (int, Out)) http.Handler

func JsonHandlerOut

func JsonHandlerOut[Out any](handler func(r *http.Request) (int, Out)) http.Handler

func MarshallJson

func MarshallJson[Type any](value Type) ([]byte, error)

func MarshallString

func MarshallString(value string) ([]byte, error)

func NewClient

func NewClient(server *httptest.Server) *http.Client

func StringHandlerInOut

func StringHandlerInOut(handler func(r *http.Request, in string) (int, string)) http.Handler

func StringHandlerOut

func StringHandlerOut(handler func(r *http.Request) (int, string)) http.Handler

func UnmarshallJson

func UnmarshallJson[Type any](data []byte) (Type, error)

func UnmarshallString

func UnmarshallString(data []byte) (string, error)

Types

type Marshaller

type Marshaller[Type any] interface {
	Marshall(v Type) ([]byte, error)
}

type MarshallerFunc

type MarshallerFunc[Type any] func(v Type) ([]byte, error)

func (MarshallerFunc[Type]) Marshall

func (f MarshallerFunc[Type]) Marshall(v Type) ([]byte, error)

type Unmarshaller

type Unmarshaller[Type any] interface {
	Unmarshal(data []byte) (Type, error)
}

type UnmarshallerFunc

type UnmarshallerFunc[Type any] func([]byte) (Type, error)

func (UnmarshallerFunc[Type]) Unmarshal

func (f UnmarshallerFunc[Type]) Unmarshal(data []byte) (Type, error)

Jump to

Keyboard shortcuts

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