Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SampleDesc desc.ServiceDescFunc = func() *desc.Service { return desc.NewService("SampleService"). SetEncoding(kit.JSON). AddError(dto.Err(http.StatusBadRequest, "INPUT")). AddContract( desc.NewContract(). SetInput(&dto.EchoRequest{}). SetOutput(&dto.EchoResponse{}). NamedSelector("EchoGET", fasthttp.REST(http.MethodGet, "/echo/:randomID")). NamedSelector("EchoPOST", fasthttp.REST(http.MethodPost, "/echo-post")). NamedSelector("EchoRPC", fasthttp.RPC("echoRequest")). AddModifier(func(envelope *kit.Envelope) { envelope.SetHdr("X-Custom-Header", "justForTestingModifier") }). SetHandler(EchoHandler), ). AddContract( desc.NewContract(). SetName("Sum"). SetInput(&dto.SumRequest{}). SetOutput(&dto.SumResponse{}). NamedSelector("Sum1", fasthttp.REST(http.MethodGet, "/sum/:val1/:val2")). NamedSelector("Sum2", fasthttp.REST(http.MethodPost, "/sum")). SetHandler(SumHandler), ). AddContract( desc.NewContract(). SetInput(&dto.SumRequest{}). SetOutput(&dto.SumResponse{}). NamedSelector("SumRedirect", fasthttp.REST(http.MethodGet, "/sum-redirect/:val1/:val2")). Selector(fasthttp.REST(http.MethodPost, "/sum-redirect")). SetHandler(SumRedirectHandler), ). AddContract( desc.NewContract(). SetInput(&dto.RedirectRequest{}). Selector(fasthttp.REST(http.MethodGet, "/redirect")). SetHandler(Redirect), ). AddContract( desc.NewContract(). SetInput(kit.RawMessage{}). SetOutput(kit.RawMessage{}). Selector(fasthttp.REST(http.MethodPost, "/raw_echo")). SetHandler(RawEchoHandler), ) }
Functions ¶
func EchoHandler ¶
func RawEchoHandler ¶
func SumHandler ¶
func SumRedirectHandler ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.