rpc

package module
v0.0.0-...-b2f33be Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const AllowHeaders = "Content-Type"

Variables

View Source
var DefaultOptions = []Option{
	WithContentEncoding(),
}
View Source
var ServeError = serveError

Functions

func UnmarshalRequest

func UnmarshalRequest(req *http.Request, v interface{}) error

Types

type Context

type Context interface {
	context.Context
	Procedure() *Procedure
	RemoteAddr() string
	URL() *url.URL
}

func FindContext

func FindContext(ctx context.Context) Context

type HTTPContext

type HTTPContext struct {
	context.Context

	Response http.ResponseWriter
	Request  *http.Request
	// contains filtered or unexported fields
}

func (HTTPContext) Procedure

func (ctx HTTPContext) Procedure() *Procedure

func (HTTPContext) RemoteAddr

func (ctx HTTPContext) RemoteAddr() string

func (*HTTPContext) Value

func (ctx *HTTPContext) Value(key interface{}) interface{}

type Option

type Option interface {
	// contains filtered or unexported methods
}
var ContentEncoding Option = contentEncoding{}

func WithContentEncoding

func WithContentEncoding() Option

type Procedure

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

func MustNew

func MustNew(fn interface{}, opts ...Option) *Procedure

func New

func New(fn interface{}, opts ...Option) (*Procedure, error)

func (*Procedure) Call

func (p *Procedure) Call(ctx context.Context, input interface{}) (output interface{}, err error)

func (Procedure) InputType

func (p Procedure) InputType() reflect.Type

func (Procedure) OutputType

func (p Procedure) OutputType() reflect.Type

func (*Procedure) ServeHTTP

func (p *Procedure) ServeHTTP(resp http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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