Documentation ¶
Index ¶
- Variables
- func MakeEndpointOfSayHello(s Service) endpoint.Endpoint
- func NewHTTPRouter(svc Service, codecs httpcodec.Codecs, opts ...httpoption.Option) chi.Router
- func OASv2APIDoc(schema oas2.Schema) string
- func ValidateSayHelloRequest(newSchema func(*SayHelloRequest) validating.Schema) httpoption.Validator
- type Greeter
- type HTTPClient
- type SayHelloRequest
- type SayHelloResponse
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var RequestValidators = []httpoption.NamedValidator{ httpoption.Op("SayHello", ValidateSayHelloRequest(func(req *SayHelloRequest) v.Schema { return v.Schema{ v.F("name", req.Name): v.All( v.LenString(0, 10).Msg("length exceeds 10"), v.Match(regexp.MustCompile(`^\w+$`)).Msg("invalid name format"), ), } })), }
Functions ¶
func MakeEndpointOfSayHello ¶
MakeEndpointOfSayHello creates the endpoint for s.SayHello.
func NewHTTPRouter ¶
func OASv2APIDoc ¶
func ValidateSayHelloRequest ¶
func ValidateSayHelloRequest(newSchema func(*SayHelloRequest) validating.Schema) httpoption.Validator
ValidateSayHelloRequest creates a validator for SayHelloRequest.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
type SayHelloRequest ¶
type SayHelloRequest struct {
Name string `json:"name"`
}
type SayHelloResponse ¶
func (*SayHelloResponse) Body ¶
func (r *SayHelloResponse) Body() interface{}
func (*SayHelloResponse) Failed ¶
func (r *SayHelloResponse) Failed() error
Failed implements endpoint.Failer.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.