api

package
v0.0.0-...-bcea4d5 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 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(status int, 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, status int, code ErrorCode, message string)

func ServeJSON

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

Types

type Check

type Check func(ctx convCtx.Context) error

type Error

type Error struct {
	Status  int       `json:"http_status,omitempty"`
	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)

func (In[inT]) WithPostCheck

func (x In[inT]) WithPostCheck(check Check) In[inT]

func (In[inT]) WithPreCheck

func (x In[inT]) WithPreCheck(check Check) In[inT]

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)

func (InOut[inT, outT]) WithPostCheck

func (x InOut[inT, outT]) WithPostCheck(check Check) InOut[inT, outT]

func (InOut[inT, outT]) WithPreCheck

func (x InOut[inT, outT]) WithPreCheck(check Check) InOut[inT, outT]

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)

func (InOutP1[inT, outT, p1T]) WithPostCheck

func (x InOutP1[inT, outT, p1T]) WithPostCheck(check Check) InOutP1[inT, outT, p1T]

func (InOutP1[inT, outT, p1T]) WithPreCheck

func (x InOutP1[inT, outT, p1T]) WithPreCheck(check Check) InOutP1[inT, outT, p1T]

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)

func (InOutP2[inT, outT, p1T, p2T]) WithPostCheck

func (x InOutP2[inT, outT, p1T, p2T]) WithPostCheck(check Check) InOutP2[inT, outT, p1T, p2T]

func (InOutP2[inT, outT, p1T, p2T]) WithPreCheck

func (x InOutP2[inT, outT, p1T, p2T]) WithPreCheck(check Check) InOutP2[inT, outT, p1T, p2T]

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)

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

func (x InOutP3[inT, outT, p1T, p2T, p3T]) WithPostCheck(check Check) InOutP3[inT, outT, p1T, p2T, p3T]

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

func (x InOutP3[inT, outT, p1T, p2T, p3T]) WithPreCheck(check Check) InOutP3[inT, outT, p1T, p2T, p3T]

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)

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

func (x InOutP4[inT, outT, p1T, p2T, p3T, p4T]) WithPostCheck(check Check) InOutP4[inT, outT, p1T, p2T, p3T, p4T]

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

func (x InOutP4[inT, outT, p1T, p2T, p3T, p4T]) WithPreCheck(check Check) InOutP4[inT, outT, p1T, p2T, p3T, p4T]

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)

func (InP1[inT, p1T]) WithPostCheck

func (x InP1[inT, p1T]) WithPostCheck(check Check) InP1[inT, p1T]

func (InP1[inT, p1T]) WithPreCheck

func (x InP1[inT, p1T]) WithPreCheck(check Check) InP1[inT, p1T]

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)

func (InP2[inT, p1T, p2T]) WithPostCheck

func (x InP2[inT, p1T, p2T]) WithPostCheck(check Check) InP2[inT, p1T, p2T]

func (InP2[inT, p1T, p2T]) WithPreCheck

func (x InP2[inT, p1T, p2T]) WithPreCheck(check Check) InP2[inT, p1T, p2T]

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)

func (InP3[inT, p1T, p2T, p3T]) WithPostCheck

func (x InP3[inT, p1T, p2T, p3T]) WithPostCheck(check Check) InP3[inT, p1T, p2T, p3T]

func (InP3[inT, p1T, p2T, p3T]) WithPreCheck

func (x InP3[inT, p1T, p2T, p3T]) WithPreCheck(check Check) InP3[inT, p1T, p2T, p3T]

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)

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

func (x InP4[inT, p1T, p2T, p3T, p4T]) WithPostCheck(check Check) InP4[inT, p1T, p2T, p3T, p4T]

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

func (x InP4[inT, p1T, p2T, p3T, p4T]) WithPreCheck(check Check) InP4[inT, p1T, p2T, p3T, p4T]

type OpenAPI

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

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)

func (Out[outT]) WithPostCheck

func (x Out[outT]) WithPostCheck(check Check) Out[outT]

func (Out[outT]) WithPreCheck

func (x Out[outT]) WithPreCheck(check Check) Out[outT]

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)

func (OutP1[outT, p1T]) WithPostCheck

func (x OutP1[outT, p1T]) WithPostCheck(check Check) OutP1[outT, p1T]

func (OutP1[outT, p1T]) WithPreCheck

func (x OutP1[outT, p1T]) WithPreCheck(check Check) OutP1[outT, p1T]

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)

func (OutP2[outT, p1T, p2T]) WithPostCheck

func (x OutP2[outT, p1T, p2T]) WithPostCheck(check Check) OutP2[outT, p1T, p2T]

func (OutP2[outT, p1T, p2T]) WithPreCheck

func (x OutP2[outT, p1T, p2T]) WithPreCheck(check Check) OutP2[outT, p1T, p2T]

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)

func (OutP3[outT, p1T, p2T, p3T]) WithPostCheck

func (x OutP3[outT, p1T, p2T, p3T]) WithPostCheck(check Check) OutP3[outT, p1T, p2T, p3T]

func (OutP3[outT, p1T, p2T, p3T]) WithPreCheck

func (x OutP3[outT, p1T, p2T, p3T]) WithPreCheck(check Check) OutP3[outT, p1T, p2T, p3T]

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)

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

func (x OutP4[outT, p1T, p2T, p3T, p4T]) WithPostCheck(check Check) OutP4[outT, p1T, p2T, p3T, p4T]

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

func (x OutP4[outT, p1T, p2T, p3T, p4T]) WithPreCheck(check Check) OutP4[outT, p1T, p2T, p3T, p4T]

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)

func (Raw) WithPreCheck

func (x Raw) WithPreCheck(check Check) Raw

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)

func (RawP1[p1T]) WithPreCheck

func (x RawP1[p1T]) WithPreCheck(check Check) RawP1[p1T]

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)

func (RawP2[p1T, p2T]) WithPreCheck

func (x RawP2[p1T, p2T]) WithPreCheck(check Check) RawP2[p1T, p2T]

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)

func (RawP3[p1T, p2T, p3T]) WithPreCheck

func (x RawP3[p1T, p2T, p3T]) WithPreCheck(check Check) RawP3[p1T, p2T, p3T]

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)

func (RawP4[p1T, p2T, p3T, p4T]) WithPreCheck

func (x RawP4[p1T, p2T, p3T, p4T]) WithPreCheck(check Check) RawP4[p1T, p2T, p3T, p4T]

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)

func (Trigger) WithPostCheck

func (x Trigger) WithPostCheck(check Check) Trigger

func (Trigger) WithPreCheck

func (x Trigger) WithPreCheck(check Check) Trigger

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)

func (TriggerP1[p1T]) WithPostCheck

func (x TriggerP1[p1T]) WithPostCheck(check Check) TriggerP1[p1T]

func (TriggerP1[p1T]) WithPreCheck

func (x TriggerP1[p1T]) WithPreCheck(check Check) TriggerP1[p1T]

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)

func (TriggerP2[p1T, p2T]) WithPostCheck

func (x TriggerP2[p1T, p2T]) WithPostCheck(check Check) TriggerP2[p1T, p2T]

func (TriggerP2[p1T, p2T]) WithPreCheck

func (x TriggerP2[p1T, p2T]) WithPreCheck(check Check) TriggerP2[p1T, p2T]

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)

func (TriggerP3[p1T, p2T, p3T]) WithPostCheck

func (x TriggerP3[p1T, p2T, p3T]) WithPostCheck(check Check) TriggerP3[p1T, p2T, p3T]

func (TriggerP3[p1T, p2T, p3T]) WithPreCheck

func (x TriggerP3[p1T, p2T, p3T]) WithPreCheck(check Check) TriggerP3[p1T, p2T, p3T]

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)

func (TriggerP4[p1T, p2T, p3T, p4T]) WithPostCheck

func (x TriggerP4[p1T, p2T, p3T, p4T]) WithPostCheck(check Check) TriggerP4[p1T, p2T, p3T, p4T]

func (TriggerP4[p1T, p2T, p3T, p4T]) WithPreCheck

func (x TriggerP4[p1T, p2T, p3T, p4T]) WithPreCheck(check Check) TriggerP4[p1T, p2T, p3T, p4T]

Jump to

Keyboard shortcuts

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