internal

package
v0.0.0-...-5bdb617 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeBodyWithValidationHandler

func MakeBodyWithValidationHandler() handler.Handler

MakeBodyWithValidationHandler decode the given body, store it in h.body and reply with the decoded boyd

func NewBodyHandler

func NewBodyHandler() handler.Handler

NewBodyHandler decode the given body, store it in h.body and reply with the decoded boyd

func NewPathParamsHandler

func NewPathParamsHandler() handler.Handler

NewPathParamsHandler catch path params in URI, store it in h.params and reply with the params

func NewQueryParamsHandler

func NewQueryParamsHandler() handler.Handler

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

func (*OrderBody) Validate

func (b *OrderBody) Validate() error

Validate is an implementation of middleware.BodyValidation. If user UserBody is given to middleware.Body, this function was called automatically and error handled

Jump to

Keyboard shortcuts

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