input

package
v0.0.0-...-8c14554 Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	KeyURL     = "url"
	KeyMethod  = "method"
	KeyWidth   = "width"
	KeyHeight  = "height"
	KeyFormat  = "format"
	KeyQuality = "quality"

	MethodContain = "contain"
	MethodCover   = "cover"
	MethodDefault = MethodContain

	FormatJPEG    = "jpeg"
	FormatPNG     = "png"
	FormatGIF     = "gif"
	FormatDefault = FormatJPEG

	QualityMax     = 100
	QualityMin     = 0
	QualityDefault = QualityMin
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	URL     string
	Method  string
	Width   int
	Height  int
	Format  string
	Quality int
}

func New

func New(q map[string][]string) (Input, error)

func (Input) Validate

func (i Input) Validate(allowedHosts options.Hosts) (Input, error)

func (Input) ValidateFormatAndQuality

func (i Input) ValidateFormatAndQuality() (Input, error)

func (Input) ValidateMethod

func (i Input) ValidateMethod() (Input, error)

func (Input) ValidateSize

func (i Input) ValidateSize() (Input, error)

func (Input) ValidateURL

func (i Input) ValidateURL(allowedHosts options.Hosts) (Input, error)

type InvalidFormatError

type InvalidFormatError struct {
	Format string
}

func NewInvalidFormatError

func NewInvalidFormatError(format string) InvalidFormatError

func (InvalidFormatError) Error

func (err InvalidFormatError) Error() string

type InvalidHostError

type InvalidHostError struct {
	Host string
}

func NewInvalidHostError

func NewInvalidHostError(host string) InvalidHostError

func (InvalidHostError) Error

func (err InvalidHostError) Error() string

type InvalidMethodError

type InvalidMethodError struct {
	Method string
}

func NewInvalidMethodError

func NewInvalidMethodError(method string) InvalidMethodError

func (InvalidMethodError) Error

func (err InvalidMethodError) Error() string

type InvalidQualityError

type InvalidQualityError struct {
	Quality int
}

func NewInvalidQualityError

func NewInvalidQualityError(quality int) InvalidQualityError

func (InvalidQualityError) Error

func (err InvalidQualityError) Error() string

type InvalidSchemeError

type InvalidSchemeError struct {
	Scheme string
}

func NewInvalidSchemeError

func NewInvalidSchemeError(scheme string) InvalidSchemeError

func (InvalidSchemeError) Error

func (err InvalidSchemeError) Error() string

type InvalidSizeError

type InvalidSizeError struct {
	Width  int
	Height int
}

func NewInvalidSizeError

func NewInvalidSizeError(width, height int) InvalidSizeError

func (InvalidSizeError) Error

func (err InvalidSizeError) Error() string

Jump to

Keyboard shortcuts

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