inputs

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addition

type Addition struct {
	A int
	B int
}

Addition represents the data from the client's request.

func NewAddition

func NewAddition() *Addition

NewAddition is the constructor and, by convention, sets the data to garbage values.

func (*Addition) Bind

func (this *Addition) Bind(request *http.Request) error

Bind is your only opportunity to get data from the request. Returning an error indicates that the request data is completely inscrutable. In such a case, processing will be short-circuited resulting in HTTP 400 Bad Request.

func (*Addition) Reset

func (this *Addition) Reset()

Reset is called by shuttle to prepare the instance for use with the current request. This instance will be re-used over the lifetime of the application.

func (*Addition) Validate

func (this *Addition) Validate(errors []error) (count int)

Validate is an opportunity to ensure that the values gathered during Bind are usable. The errors slice provided is pre-initialized and can be directly assigned to, beginning at index 0. The presence of any errors short-circuits processing and results in HTTP 422 Unprocessable Entity.

type Subtraction

type Subtraction struct {
	shuttle.BaseInputModel
	A int `json:"a"`
	B int `json:"b"`
}

func NewSubtraction

func NewSubtraction() *Subtraction

func (*Subtraction) Reset

func (this *Subtraction) Reset()

func (*Subtraction) Validate

func (this *Subtraction) Validate(errors []error) (count int)

Jump to

Keyboard shortcuts

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