Documentation
¶
Overview ¶
Package example is the fixture of the generator. Its generated file is committed, so the gate compiles and runs the code that the generator writes.
Every supported type and every rule of the SDD appears here one time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateInput ¶
type CreateInput struct {
// BoardID comes from the path, which wins over every other source.
BoardID string `path:"board_id" validate:"required,uuid"`
// Title comes from the form or from the body.
Title string `json:"title" form:"title" validate:"required,min=3,max=50"`
// Email covers the email rule.
Email string `json:"email" form:"email" validate:"required,email"`
// Role covers the oneof rule.
Role string `json:"role" form:"role" validate:"oneof=admin member viewer"`
// Page covers a signed integer and the numeric bounds.
Page int `query:"page" validate:"min=1,max=100"`
// Size covers a sized integer.
Size int64 `query:"size"`
// Ratio covers a float.
Ratio float64 `query:"ratio"`
// Notify covers a boolean. A boolean never carries the required rule.
Notify bool `json:"notify" form:"notify" query:"notify"`
// Timeout covers a duration.
Timeout time.Duration `query:"timeout"`
// StartsAt covers a time.
StartsAt time.Time `query:"starts_at" json:"starts_at"`
// Tags covers a repeated value.
Tags []string `query:"tags" json:"tags"`
// Computed binds from nothing. The handler fills it.
Computed string `avero:"-"`
}
CreateInput covers every source and every rule.
func (*CreateInput) Bind ¶
func (in *CreateInput) Bind(c *router.Ctx) error
Bind fills CreateInput from the request.
The sources are the JSON body, the form, the query and the path, in that order. A later source replaces an earlier one, so the path wins.
type ListInput ¶
type ListInput struct {
// Query comes from the query string only.
Query string `query:"q" validate:"max=64"`
}
ListInput covers a type with no custom rule.
Click to show internal directories.
Click to hide internal directories.