proto

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IApiHandler

type IApiHandler[Request, Response any] interface {
	FormParams() any
	Errors() []error
	Method() string
	Path() string
	Description() string
	Handle(Request) (Response, error)
}

type IDispatcher added in v0.13.0

type IDispatcher interface {
	Dispatch(IRawRequest) types.InternalResponse
}

type IEngine added in v0.13.0

type IEngine interface {
	Spawn(
		addr string,
		disp IDispatcher,
		tls_cert string,
		tls_key string,
	) error
}

type IErrToApiProcessor

type IErrToApiProcessor interface {
	Wrap(error) (int, []byte)
}

type IFormParam added in v0.11.0

type IFormParam interface {
	ParseForm(string) (any, error) // return self
	GenFormSample() string
}

type IHandlerContainer

type IHandlerContainer interface {
	GetHandler(method, path string) (IWrappedHandler, map[string]string)
	GetRoot() IRoutable
}

type IHeaderParam added in v0.6.0

type IHeaderParam interface {
	ParseHeader(string) (any, error) // return self
	GenHeaderSample() string
}

type IHeaderRequest added in v0.14.0

type IHeaderRequest interface {
	HeaderSet(string, string)
	HeaderGet(string) string
	HeaderGetMany(string) []string
}

type IIntoResponse added in v0.8.0

type IIntoResponse interface {
	ResponseType() reflect.Type
	IntoResponse() types.Response
}

type IMiddleware added in v0.13.0

type IMiddleware interface {
	OnReq(IMiddlewareReqArg) error
	OnResp(IMiddlewareRespArg) error
	OnErr(IMiddlewareErrArg) error
}

type IMiddlewareErrArg added in v0.10.0

type IMiddlewareErrArg interface {
	IMiddlewareReqArg
	GetErr() error
}

type IMiddlewareReqArg added in v0.10.0

type IMiddlewareReqArg interface {
	IHeaderRequest
	Path() string
	Method() string
	Context() map[string]any
}

type IMiddlewareRespArg added in v0.10.0

type IMiddlewareRespArg interface {
	IMiddlewareReqArg
	GetStatus() int
	SetStatus(int)
	GetBody() []byte
}

type IQueryParam added in v0.6.0

type IQueryParam interface {
	ParseQuery(string) (any, error) // return self
	GenQuerySample() string
}

type IQueryRequest added in v0.14.0

type IQueryRequest interface {
	QueryGet(string) (string, bool)
	QueryGetMany(string) ([]string, bool)
}

type IRawRequest added in v0.14.0

type IRawRequest interface {
	IQueryRequest
	IHeaderRequest
	Method() string
	Path() string
	QueryRaw() string
	GetBody() ([]byte, error)
	FormFile(string) (*multipart.FileHeader, error)
	FormValue(string) string
}

type IReqParser added in v0.6.0

type IReqParser interface {
	Parse(
		req IRawRequest,
		path_vars map[string]string,
		context types.Context,
	) (any, error)
	HParams() []types.HParam
	QParams() []types.QParam
	FParams() []types.FParam
	BodyType() *reflect.Type // may be nil
}

type IRoutable added in v0.5.0

type IRoutable interface {
	Path() types.PathPttrn
	IsRouter() bool
	Method() string

	// WithPrefix(string) IRoutable
	Children() []IRoutable
	DowncastHandler() IWrappedHandler
	DowncastRouter() IRouter
}

type IRouter added in v0.7.0

type IRouter interface {
	IRoutable
	AddChildren([]IRoutable)
}

type IWrappedHandler

type IWrappedHandler interface {
	IRoutable
	FormParams() any
	// Method() string
	// Path() string
	Description(full_path string) string
	RequestParser() IReqParser
	Handle(
		IRawRequest,
		types.InternalRequest,
	) (types.InternalResponse, error)
}

type ParamHandlerMaker added in v0.12.0

type ParamHandlerMaker = func(
	path types.PathPttrn, params any,
) (IRoutable, error)

type ResSerializer added in v0.12.0

type ResSerializer = func(
	obj any,
	headers IHeaderRequest,
) (types.InternalResponse, error)

Jump to

Keyboard shortcuts

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