Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeBodyWithValidationHandler ¶
MakeBodyWithValidationHandler decode the given body, store it in h.body and reply with the decoded boyd
func NewBodyHandler ¶
NewBodyHandler decode the given body, store it in h.body and reply with the decoded boyd
func NewPathParamsHandler ¶
NewPathParamsHandler catch path params in URI, store it in h.params and reply with the params
func NewQueryParamsHandler ¶
NewQueryParamsHandler catch the registered query params, store it in h.params and reply with the params
Types ¶
type OrderBody ¶
type OrderBody struct {
// The required tag validates that the value is not the data types default zero value
// For numbers ensures value is not zero. For strings ensures value is not "".
// For slices, maps, pointers, interfaces, channels and functions ensures the value is not nil.
// You can add validation using the pattern tag which is a regexp condition
// that the value of the field product_id must follow works also for float and integer
ProductID string `json:"product_id" required:"true" pattern:"^product_[\\d_]+"`
// if you want to make a custom validation you can implement Validate() as the example bellow for quantity.
Quantity int `json:"quantity"`
}
OrderBody : struct that represent the body used by bodyWithValidationHandler
Click to show internal directories.
Click to hide internal directories.