Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Export ¶
func Export[Request, Response any](method HandlerFunc[Request, Response])
Export exports a method to RPC. The name of method will be converted to kebab-case.
func ExportName ¶
func ExportName[Request, Response any](name string, method HandlerFunc[Request, Response])
ExportName exports a method to RPC with specified name.
Types ¶
type HandlerFunc ¶
type HandlerFunc[Request, Response any] func(ctx context.Context, req *Request) (resp *Response, err error)
func Compile ¶
func Compile[Request, Response any](method HandlerFunc[Request, Response]) HandlerFunc[Request, Response]
Compile wraps a method with request validator, initer and error handler. The returned method is used in RPC server to handle any request.
Business code should never call Compile unless for test purpose, e.g. writing unit test cases for a RPC method.
Click to show internal directories.
Click to hide internal directories.