api

package
v0.0.0-...-ae6a5fa Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(ctx convCtx.Context, host string, port int, svc any) (err error)

func NewClient

func NewClient[svcT any](host string, port int) (svc *svcT)

func NewError

func NewError(code ErrorCode, message string) (err error)

func NewHandler

func NewHandler(ctx convCtx.Context, host string, port int, svc any) http.Handler

func ReceiveJSON

func ReceiveJSON[T any](r *http.Request) (res T, err error)

func ServeError

func ServeError(w http.ResponseWriter, code ErrorCode, message string)

func ServeJSON

func ServeJSON(w http.ResponseWriter, body any) error

Types

type Error

type Error struct {
	Code    ErrorCode `json:"code,omitempty"`
	Message string    `json:"message,omitempty"`
}

func (Error) Error

func (e Error) Error() string

type ErrorCode

type ErrorCode string
const (
	ErrorCodeInternalError ErrorCode = "internal_error"
	ErrorCodeNotFound      ErrorCode = "not_found"
	ErrorCodeBadRequest    ErrorCode = "bad_request"
)

type In

type In[inT any] struct {
	// contains filtered or unexported fields
}

func NewIn

func NewIn[inT any](fn func(ctx convCtx.Context, in inT) error) In[inT]

func (*In[inT]) Call

func (x *In[inT]) Call(ctx convCtx.Context, in inT) (err error)

type InOut

type InOut[inT, outT any] struct {
	// contains filtered or unexported fields
}

func NewInOut

func NewInOut[inT, outT any](fn func(ctx convCtx.Context, in inT) (outT, error)) InOut[inT, outT]

func (*InOut[inT, outT]) Call

func (x *InOut[inT, outT]) Call(ctx convCtx.Context, in inT) (out outT, err error)

type InOutP1

type InOutP1[inT, outT any, p1T ~string] struct {
	// contains filtered or unexported fields
}

func NewInOutP1

func NewInOutP1[inT, outT any, p1T ~string](fn func(ctx convCtx.Context, p1 p1T, in inT) (outT, error)) InOutP1[inT, outT, p1T]

func (*InOutP1[inT, outT, p1T]) Call

func (x *InOutP1[inT, outT, p1T]) Call(ctx convCtx.Context, p1 p1T, in inT) (out outT, err error)

type InOutP2

type InOutP2[inT, outT any, p1T, p2T ~string] struct {
	// contains filtered or unexported fields
}

func NewInOutP2

func NewInOutP2[inT, outT any, p1T, p2T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, in inT) (outT, error)) InOutP2[inT, outT, p1T, p2T]

func (*InOutP2[inT, outT, p1T, p2T]) Call

func (x *InOutP2[inT, outT, p1T, p2T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, in inT) (out outT, err error)

type InOutP3

type InOutP3[inT, outT any, p1T, p2T, p3T ~string] struct {
	// contains filtered or unexported fields
}

func NewInOutP3

func NewInOutP3[inT, outT any, p1T, p2T, p3T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, in inT) (outT, error)) InOutP3[inT, outT, p1T, p2T, p3T]

func (*InOutP3[inT, outT, p1T, p2T, p3T]) Call

func (x *InOutP3[inT, outT, p1T, p2T, p3T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, in inT) (out outT, err error)

type InOutP4

type InOutP4[inT, outT any, p1T, p2T, p3T, p4T ~string] struct {
	// contains filtered or unexported fields
}

func NewInOutP4

func NewInOutP4[inT, outT any, p1T, p2T, p3T, p4T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T, in inT) (outT, error)) InOutP4[inT, outT, p1T, p2T, p3T, p4T]

func (*InOutP4[inT, outT, p1T, p2T, p3T, p4T]) Call

func (x *InOutP4[inT, outT, p1T, p2T, p3T, p4T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T, in inT) (out outT, err error)

type InP1

type InP1[inT any, p1T ~string] struct {
	// contains filtered or unexported fields
}

func NewInP1

func NewInP1[inT any, p1T ~string](fn func(ctx convCtx.Context, p1 p1T, in inT) error) InP1[inT, p1T]

func (*InP1[inT, p1T]) Call

func (x *InP1[inT, p1T]) Call(ctx convCtx.Context, p1 p1T, in inT) (err error)

type InP2

type InP2[inT any, p1T, p2T ~string] struct {
	// contains filtered or unexported fields
}

func NewInP2

func NewInP2[inT any, p1T, p2T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, in inT) error) InP2[inT, p1T, p2T]

func (*InP2[inT, p1T, p2T]) Call

func (x *InP2[inT, p1T, p2T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, in inT) (err error)

type InP3

type InP3[inT any, p1T, p2T, p3T ~string] struct {
	// contains filtered or unexported fields
}

func NewInP3

func NewInP3[inT any, p1T, p2T, p3T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, in inT) error) InP3[inT, p1T, p2T, p3T]

func (*InP3[inT, p1T, p2T, p3T]) Call

func (x *InP3[inT, p1T, p2T, p3T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, in inT) (err error)

type InP4

type InP4[inT any, p1T, p2T, p3T, p4T ~string] struct {
	// contains filtered or unexported fields
}

func NewInP4

func NewInP4[inT any, p1T, p2T, p3T, p4T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T, in inT) error) InP4[inT, p1T, p2T, p3T, p4T]

func (*InP4[inT, p1T, p2T, p3T, p4T]) Call

func (x *InP4[inT, p1T, p2T, p3T, p4T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T, in inT) (err error)

type Out

type Out[outT any] struct {
	// contains filtered or unexported fields
}

func NewOut

func NewOut[outT any](fn func(ctx convCtx.Context) (outT, error)) Out[outT]

func (*Out[outT]) Call

func (x *Out[outT]) Call(ctx convCtx.Context) (out outT, err error)

type OutP1

type OutP1[outT any, p1T ~string] struct {
	// contains filtered or unexported fields
}

func NewOutP1

func NewOutP1[outT any, p1T ~string](fn func(ctx convCtx.Context, p1 p1T) (outT, error)) OutP1[outT, p1T]

func (*OutP1[outT, p1T]) Call

func (x *OutP1[outT, p1T]) Call(ctx convCtx.Context, p1 p1T) (out outT, err error)

type OutP2

type OutP2[outT any, p1T, p2T ~string] struct {
	// contains filtered or unexported fields
}

func NewOutP2

func NewOutP2[outT any, p1T, p2T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T) (outT, error)) OutP2[outT, p1T, p2T]

func (*OutP2[outT, p1T, p2T]) Call

func (x *OutP2[outT, p1T, p2T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T) (out outT, err error)

type OutP3

type OutP3[outT any, p1T, p2T, p3T ~string] struct {
	// contains filtered or unexported fields
}

func NewOutP3

func NewOutP3[outT any, p1T, p2T, p3T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T) (outT, error)) OutP3[outT, p1T, p2T, p3T]

func (*OutP3[outT, p1T, p2T, p3T]) Call

func (x *OutP3[outT, p1T, p2T, p3T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T) (out outT, err error)

type OutP4

type OutP4[outT any, p1T, p2T, p3T, p4T ~string] struct {
	// contains filtered or unexported fields
}

func NewOutP4

func NewOutP4[outT any, p1T, p2T, p3T, p4T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T) (outT, error)) OutP4[outT, p1T, p2T, p3T, p4T]

func (*OutP4[outT, p1T, p2T, p3T, p4T]) Call

func (x *OutP4[outT, p1T, p2T, p3T, p4T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T) (out outT, err error)

type Raw

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

func NewRaw

func NewRaw(fn func(ctx convCtx.Context, w http.ResponseWriter, r *http.Request)) Raw

func (*Raw) Call

func (x *Raw) Call(ctx convCtx.Context, body io.Reader) (err error)

type RawP1

type RawP1[p1T ~string] struct {
	// contains filtered or unexported fields
}

func NewRawP1

func NewRawP1[p1T ~string](fn func(ctx convCtx.Context, p1 p1T, w http.ResponseWriter, r *http.Request)) RawP1[p1T]

func (*RawP1[p1T]) Call

func (x *RawP1[p1T]) Call(ctx convCtx.Context, p1 p1T, body io.Reader) (err error)

type RawP2

type RawP2[p1T, p2T ~string] struct {
	// contains filtered or unexported fields
}

func NewRawP2

func NewRawP2[p1T, p2T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, w http.ResponseWriter, r *http.Request)) RawP2[p1T, p2T]

func (*RawP2[p1T, p2T]) Call

func (x *RawP2[p1T, p2T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, body io.Reader) (err error)

type RawP3

type RawP3[p1T, p2T, p3T ~string] struct {
	// contains filtered or unexported fields
}

func NewRawP3

func NewRawP3[p1T, p2T, p3T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, w http.ResponseWriter, r *http.Request)) RawP3[p1T, p2T, p3T]

func (*RawP3[p1T, p2T, p3T]) Call

func (x *RawP3[p1T, p2T, p3T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, body io.Reader) (err error)

type RawP4

type RawP4[p1T, p2T, p3T, p4T ~string] struct {
	// contains filtered or unexported fields
}

func NewRawP4

func NewRawP4[p1T, p2T, p3T, p4T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T, w http.ResponseWriter, r *http.Request)) RawP4[p1T, p2T, p3T, p4T]

func (*RawP4[p1T, p2T, p3T, p4T]) Call

func (x *RawP4[p1T, p2T, p3T, p4T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T, body io.Reader) (err error)

type Trigger

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

func NewTrigger

func NewTrigger(fn func(ctx convCtx.Context) error) Trigger

func (*Trigger) Call

func (x *Trigger) Call(ctx convCtx.Context) (err error)

type TriggerP1

type TriggerP1[p1T ~string] struct {
	// contains filtered or unexported fields
}

func NewTriggerP1

func NewTriggerP1[p1T ~string](fn func(ctx convCtx.Context, p1 p1T) error) TriggerP1[p1T]

func (*TriggerP1[p1T]) Call

func (x *TriggerP1[p1T]) Call(ctx convCtx.Context, p1 p1T) (err error)

type TriggerP2

type TriggerP2[p1T, p2T ~string] struct {
	// contains filtered or unexported fields
}

func NewTriggerP2

func NewTriggerP2[p1T, p2T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T) error) TriggerP2[p1T, p2T]

func (*TriggerP2[p1T, p2T]) Call

func (x *TriggerP2[p1T, p2T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T) (err error)

type TriggerP3

type TriggerP3[p1T, p2T, p3T ~string] struct {
	// contains filtered or unexported fields
}

func NewTriggerP3

func NewTriggerP3[p1T, p2T, p3T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T) error) TriggerP3[p1T, p2T, p3T]

func (*TriggerP3[p1T, p2T, p3T]) Call

func (x *TriggerP3[p1T, p2T, p3T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T) (err error)

type TriggerP4

type TriggerP4[p1T, p2T, p3T, p4T ~string] struct {
	// contains filtered or unexported fields
}

func NewTriggerP4

func NewTriggerP4[p1T, p2T, p3T, p4T ~string](fn func(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T) error) TriggerP4[p1T, p2T, p3T, p4T]

func (*TriggerP4[p1T, p2T, p3T, p4T]) Call

func (x *TriggerP4[p1T, p2T, p3T, p4T]) Call(ctx convCtx.Context, p1 p1T, p2 p2T, p3 p3T, p4 p4T) (err error)

Jump to

Keyboard shortcuts

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