Documentation ¶
Index ¶
- Constants
- Variables
- func Bind(r *http.Request, i interface{}) (err error)
- func BindBody(r *http.Request, i interface{}) (err error)
- func BindHeaders(r *http.Request, i interface{}) error
- func BindPathParams(r *http.Request, i interface{}) error
- func BindQueryParams(r *http.Request, i interface{}) error
- func NewBindingError(sourceParam string, values []string, message string, internalError error) error
- type BindUnmarshaler
- type Binder
- type BindingError
- type ValueBinder
- func (b *ValueBinder) BindError() error
- func (b *ValueBinder) BindErrors() []error
- func (b *ValueBinder) BindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder
- func (b *ValueBinder) BindWithDelimiter(sourceParam string, dest interface{}, delimiter string) *ValueBinder
- func (b *ValueBinder) Bool(sourceParam string, dest *bool) *ValueBinder
- func (b *ValueBinder) Bools(sourceParam string, dest *[]bool) *ValueBinder
- func (b *ValueBinder) Byte(sourceParam string, dest *byte) *ValueBinder
- func (b *ValueBinder) CustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder
- func (b *ValueBinder) Duration(sourceParam string, dest *time.Duration) *ValueBinder
- func (b *ValueBinder) Durations(sourceParam string, dest *[]time.Duration) *ValueBinder
- func (b *ValueBinder) FailFast(value bool) *ValueBinder
- func (b *ValueBinder) Float32(sourceParam string, dest *float32) *ValueBinder
- func (b *ValueBinder) Float32s(sourceParam string, dest *[]float32) *ValueBinder
- func (b *ValueBinder) Float64(sourceParam string, dest *float64) *ValueBinder
- func (b *ValueBinder) Float64s(sourceParam string, dest *[]float64) *ValueBinder
- func (b *ValueBinder) Int(sourceParam string, dest *int) *ValueBinder
- func (b *ValueBinder) Int16(sourceParam string, dest *int16) *ValueBinder
- func (b *ValueBinder) Int16s(sourceParam string, dest *[]int16) *ValueBinder
- func (b *ValueBinder) Int32(sourceParam string, dest *int32) *ValueBinder
- func (b *ValueBinder) Int32s(sourceParam string, dest *[]int32) *ValueBinder
- func (b *ValueBinder) Int64(sourceParam string, dest *int64) *ValueBinder
- func (b *ValueBinder) Int64s(sourceParam string, dest *[]int64) *ValueBinder
- func (b *ValueBinder) Int8(sourceParam string, dest *int8) *ValueBinder
- func (b *ValueBinder) Int8s(sourceParam string, dest *[]int8) *ValueBinder
- func (b *ValueBinder) Ints(sourceParam string, dest *[]int) *ValueBinder
- func (b *ValueBinder) JSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder
- func (b *ValueBinder) MustBindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder
- func (b *ValueBinder) MustBindWithDelimiter(sourceParam string, dest interface{}, delimiter string) *ValueBinder
- func (b *ValueBinder) MustBool(sourceParam string, dest *bool) *ValueBinder
- func (b *ValueBinder) MustBools(sourceParam string, dest *[]bool) *ValueBinder
- func (b *ValueBinder) MustByte(sourceParam string, dest *byte) *ValueBinder
- func (b *ValueBinder) MustCustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder
- func (b *ValueBinder) MustDuration(sourceParam string, dest *time.Duration) *ValueBinder
- func (b *ValueBinder) MustDurations(sourceParam string, dest *[]time.Duration) *ValueBinder
- func (b *ValueBinder) MustFloat32(sourceParam string, dest *float32) *ValueBinder
- func (b *ValueBinder) MustFloat32s(sourceParam string, dest *[]float32) *ValueBinder
- func (b *ValueBinder) MustFloat64(sourceParam string, dest *float64) *ValueBinder
- func (b *ValueBinder) MustFloat64s(sourceParam string, dest *[]float64) *ValueBinder
- func (b *ValueBinder) MustInt(sourceParam string, dest *int) *ValueBinder
- func (b *ValueBinder) MustInt16(sourceParam string, dest *int16) *ValueBinder
- func (b *ValueBinder) MustInt16s(sourceParam string, dest *[]int16) *ValueBinder
- func (b *ValueBinder) MustInt32(sourceParam string, dest *int32) *ValueBinder
- func (b *ValueBinder) MustInt32s(sourceParam string, dest *[]int32) *ValueBinder
- func (b *ValueBinder) MustInt64(sourceParam string, dest *int64) *ValueBinder
- func (b *ValueBinder) MustInt64s(sourceParam string, dest *[]int64) *ValueBinder
- func (b *ValueBinder) MustInt8(sourceParam string, dest *int8) *ValueBinder
- func (b *ValueBinder) MustInt8s(sourceParam string, dest *[]int8) *ValueBinder
- func (b *ValueBinder) MustInts(sourceParam string, dest *[]int) *ValueBinder
- func (b *ValueBinder) MustJSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder
- func (b *ValueBinder) MustString(sourceParam string, dest *string) *ValueBinder
- func (b *ValueBinder) MustStrings(sourceParam string, dest *[]string) *ValueBinder
- func (b *ValueBinder) MustTextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder
- func (b *ValueBinder) MustTime(sourceParam string, dest *time.Time, layout string) *ValueBinder
- func (b *ValueBinder) MustTimes(sourceParam string, dest *[]time.Time, layout string) *ValueBinder
- func (b *ValueBinder) MustUint(sourceParam string, dest *uint) *ValueBinder
- func (b *ValueBinder) MustUint16(sourceParam string, dest *uint16) *ValueBinder
- func (b *ValueBinder) MustUint16s(sourceParam string, dest *[]uint16) *ValueBinder
- func (b *ValueBinder) MustUint32(sourceParam string, dest *uint32) *ValueBinder
- func (b *ValueBinder) MustUint32s(sourceParam string, dest *[]uint32) *ValueBinder
- func (b *ValueBinder) MustUint64(sourceParam string, dest *uint64) *ValueBinder
- func (b *ValueBinder) MustUint64s(sourceParam string, dest *[]uint64) *ValueBinder
- func (b *ValueBinder) MustUint8(sourceParam string, dest *uint8) *ValueBinder
- func (b *ValueBinder) MustUint8s(sourceParam string, dest *[]uint8) *ValueBinder
- func (b *ValueBinder) MustUints(sourceParam string, dest *[]uint) *ValueBinder
- func (b *ValueBinder) MustUnixTime(sourceParam string, dest *time.Time) *ValueBinder
- func (b *ValueBinder) MustUnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder
- func (b *ValueBinder) MustUnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder
- func (b *ValueBinder) String(sourceParam string, dest *string) *ValueBinder
- func (b *ValueBinder) Strings(sourceParam string, dest *[]string) *ValueBinder
- func (b *ValueBinder) TextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder
- func (b *ValueBinder) Time(sourceParam string, dest *time.Time, layout string) *ValueBinder
- func (b *ValueBinder) Times(sourceParam string, dest *[]time.Time, layout string) *ValueBinder
- func (b *ValueBinder) Uint(sourceParam string, dest *uint) *ValueBinder
- func (b *ValueBinder) Uint16(sourceParam string, dest *uint16) *ValueBinder
- func (b *ValueBinder) Uint16s(sourceParam string, dest *[]uint16) *ValueBinder
- func (b *ValueBinder) Uint32(sourceParam string, dest *uint32) *ValueBinder
- func (b *ValueBinder) Uint32s(sourceParam string, dest *[]uint32) *ValueBinder
- func (b *ValueBinder) Uint64(sourceParam string, dest *uint64) *ValueBinder
- func (b *ValueBinder) Uint64s(sourceParam string, dest *[]uint64) *ValueBinder
- func (b *ValueBinder) Uint8(sourceParam string, dest *uint8) *ValueBinder
- func (b *ValueBinder) Uint8s(sourceParam string, dest *[]uint8) *ValueBinder
- func (b *ValueBinder) Uints(sourceParam string, dest *[]uint) *ValueBinder
- func (b *ValueBinder) UnixTime(sourceParam string, dest *time.Time) *ValueBinder
- func (b *ValueBinder) UnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder
- func (b *ValueBinder) UnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder
Constants ¶
const ( // MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259 MIMEApplicationJSON = "application/json" MIMEApplicationJavaScript = "application/javascript" MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + charsetUTF8 MIMEApplicationXML = "application/xml" MIMEApplicationXMLCharsetUTF8 = MIMEApplicationXML + "; " + charsetUTF8 MIMETextXML = "text/xml" MIMETextXMLCharsetUTF8 = MIMETextXML + "; " + charsetUTF8 MIMEApplicationForm = "application/x-www-form-urlencoded" MIMEApplicationProtobuf = "application/protobuf" MIMEApplicationMsgpack = "application/msgpack" MIMETextHTML = "text/html" MIMETextHTMLCharsetUTF8 = MIMETextHTML + "; " + charsetUTF8 MIMETextPlain = "text/plain" MIMETextPlainCharsetUTF8 = MIMETextPlain + "; " + charsetUTF8 MIMEMultipartForm = "multipart/form-data" MIMEOctetStream = "application/octet-stream" )
MIME types
const ( HeaderAccept = "Accept" HeaderAcceptEncoding = "Accept-Encoding" // HeaderAllow is the name of the "Allow" header field used to list the set of methods // advertised as supported by the target resource. Returning an Allow header is mandatory // for status 405 (method not found) and useful for the OPTIONS method in responses. // See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1 HeaderAllow = "Allow" HeaderAuthorization = "Authorization" HeaderContentDisposition = "Content-Disposition" HeaderContentEncoding = "Content-Encoding" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" HeaderCookie = "Cookie" HeaderSetCookie = "Set-Cookie" HeaderIfModifiedSince = "If-Modified-Since" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderRetryAfter = "Retry-After" HeaderUpgrade = "Upgrade" HeaderVary = "Vary" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedProtocol = "X-Forwarded-Protocol" HeaderXForwardedSsl = "X-Forwarded-Ssl" HeaderXUrlScheme = "X-Url-Scheme" HeaderXHTTPMethodOverride = "X-HTTP-Method-Override" HeaderXRealIP = "X-Real-Ip" HeaderXRequestID = "X-Request-Id" HeaderXCorrelationID = "X-Correlation-Id" HeaderXRequestedWith = "X-Requested-With" HeaderServer = "Server" HeaderOrigin = "Origin" HeaderCacheControl = "Cache-Control" HeaderConnection = "Connection" // Access control HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" // Security HeaderStrictTransportSecurity = "Strict-Transport-Security" HeaderXContentTypeOptions = "X-Content-Type-Options" HeaderXXSSProtection = "X-XSS-Protection" HeaderXFrameOptions = "X-Frame-Options" HeaderContentSecurityPolicy = "Content-Security-Policy" HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only" HeaderXCSRFToken = "X-CSRF-Token" HeaderReferrerPolicy = "Referrer-Policy" )
Headers
Variables ¶
var ErrUnsupportedMediaType = errors.New("unsupported media type")
Functions ¶
func Bind ¶
Bind implements the `Binder#Bind` function. Binding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous step binded values. For single source binding use their own methods BindBody, BindQueryParams, BindPathParams.
func BindBody ¶
BindBody binds request body contents to bindable object NB: then binding forms take note that this implementation uses standard library form parsing which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm See non-MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseForm See MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseMultipartForm
func BindHeaders ¶
BindHeaders binds HTTP headers to a bindable object
func BindPathParams ¶
BindPathParams binds path params to bindable object; only chi is supported
func BindQueryParams ¶
BindQueryParams binds query params to bindable object
Types ¶
type BindUnmarshaler ¶
type BindUnmarshaler interface { // UnmarshalParam decodes and assigns a value from an form or query param. UnmarshalParam(param string) error }
BindUnmarshaler is the interface used to wrap the UnmarshalParam method. Types that don't implement this, but do implement encoding.TextUnmarshaler will use that interface instead.
type BindingError ¶
type BindingError struct { // Field is the field name where value binding failed Field string `json:"field"` // Values of parameter that failed to bind. Values []string `json:"-"` Message string InternalError error }
BindingError represents an error that occurred while binding request data.
type ValueBinder ¶
type ValueBinder struct { // ValueFunc is used to get single parameter (first) value from request ValueFunc func(sourceParam string) string // ValuesFunc is used to get all values for parameter from request. i.e. `/api/search?ids=1&ids=2` ValuesFunc func(sourceParam string) []string // ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to your specific json response ErrorFunc func(sourceParam string, values []string, message string, internalError error) error // contains filtered or unexported fields }
ValueBinder provides utility methods for binding query or path parameter to various Go built-in types
func ChiPathParamsBinder ¶
func ChiPathParamsBinder(r *http.Request) *ValueBinder
PathParamsBinder creates path parameter value binder
func FormFieldBinder ¶
func FormFieldBinder(r *http.Request) *ValueBinder
FormFieldBinder creates form field value binder For all requests, FormFieldBinder parses the raw query from the URL and uses query params as form fields
For POST, PUT, and PATCH requests, it also reads the request body, parses it as a form and uses query params as form fields. Request body parameters take precedence over URL query string values in r.Form.
NB: when binding forms take note that this implementation uses standard library form parsing which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm See https://golang.org/pkg/net/http/#Request.ParseForm
func PathParamsBinder ¶
func PathParamsBinder(r *http.Request) *ValueBinder
PathParamsBinder creates path parameter value binder
func QueryParamsBinder ¶
func QueryParamsBinder(r *http.Request) *ValueBinder
QueryParamsBinder creates query parameter value binder
func (*ValueBinder) BindError ¶
func (b *ValueBinder) BindError() error
BindError returns first seen bind error and resets/empties binder errors for further calls
func (*ValueBinder) BindErrors ¶
func (b *ValueBinder) BindErrors() []error
BindErrors returns all bind errors and resets/empties binder errors for further calls
func (*ValueBinder) BindUnmarshaler ¶
func (b *ValueBinder) BindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder
BindUnmarshaler binds parameter to destination implementing BindUnmarshaler interface
func (*ValueBinder) BindWithDelimiter ¶
func (b *ValueBinder) BindWithDelimiter(sourceParam string, dest interface{}, delimiter string) *ValueBinder
BindWithDelimiter binds parameter to destination by suitable conversion function. Delimiter is used before conversion to split parameter value to separate values
func (*ValueBinder) Bool ¶
func (b *ValueBinder) Bool(sourceParam string, dest *bool) *ValueBinder
Bool binds parameter to bool variable
func (*ValueBinder) Bools ¶
func (b *ValueBinder) Bools(sourceParam string, dest *[]bool) *ValueBinder
Bools binds parameter values to slice of bool variables
func (*ValueBinder) Byte ¶
func (b *ValueBinder) Byte(sourceParam string, dest *byte) *ValueBinder
Byte binds parameter to byte variable
func (*ValueBinder) CustomFunc ¶
func (b *ValueBinder) CustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder
CustomFunc binds parameter values with Func. Func is called only when parameter values exist.
func (*ValueBinder) Duration ¶
func (b *ValueBinder) Duration(sourceParam string, dest *time.Duration) *ValueBinder
Duration binds parameter to time.Duration variable
func (*ValueBinder) Durations ¶
func (b *ValueBinder) Durations(sourceParam string, dest *[]time.Duration) *ValueBinder
Durations binds parameter values to slice of time.Duration variables
func (*ValueBinder) FailFast ¶
func (b *ValueBinder) FailFast(value bool) *ValueBinder
FailFast set internal flag to indicate if binding methods will return early (without binding) when previous bind failed NB: call this method before any other binding methods as it modifies binding methods behaviour
func (*ValueBinder) Float32 ¶
func (b *ValueBinder) Float32(sourceParam string, dest *float32) *ValueBinder
Float32 binds parameter to float32 variable
func (*ValueBinder) Float32s ¶
func (b *ValueBinder) Float32s(sourceParam string, dest *[]float32) *ValueBinder
Float32s binds parameter values to slice of float32 variables
func (*ValueBinder) Float64 ¶
func (b *ValueBinder) Float64(sourceParam string, dest *float64) *ValueBinder
Float64 binds parameter to float64 variable
func (*ValueBinder) Float64s ¶
func (b *ValueBinder) Float64s(sourceParam string, dest *[]float64) *ValueBinder
Float64s binds parameter values to slice of float64 variables
func (*ValueBinder) Int ¶
func (b *ValueBinder) Int(sourceParam string, dest *int) *ValueBinder
Int binds parameter to int variable
func (*ValueBinder) Int16 ¶
func (b *ValueBinder) Int16(sourceParam string, dest *int16) *ValueBinder
Int16 binds parameter to int16 variable
func (*ValueBinder) Int16s ¶
func (b *ValueBinder) Int16s(sourceParam string, dest *[]int16) *ValueBinder
Int16s binds parameter to slice of int16
func (*ValueBinder) Int32 ¶
func (b *ValueBinder) Int32(sourceParam string, dest *int32) *ValueBinder
Int32 binds parameter to int32 variable
func (*ValueBinder) Int32s ¶
func (b *ValueBinder) Int32s(sourceParam string, dest *[]int32) *ValueBinder
Int32s binds parameter to slice of int32
func (*ValueBinder) Int64 ¶
func (b *ValueBinder) Int64(sourceParam string, dest *int64) *ValueBinder
Int64 binds parameter to int64 variable
func (*ValueBinder) Int64s ¶
func (b *ValueBinder) Int64s(sourceParam string, dest *[]int64) *ValueBinder
Int64s binds parameter to slice of int64
func (*ValueBinder) Int8 ¶
func (b *ValueBinder) Int8(sourceParam string, dest *int8) *ValueBinder
Int8 binds parameter to int8 variable
func (*ValueBinder) Int8s ¶
func (b *ValueBinder) Int8s(sourceParam string, dest *[]int8) *ValueBinder
Int8s binds parameter to slice of int8
func (*ValueBinder) Ints ¶
func (b *ValueBinder) Ints(sourceParam string, dest *[]int) *ValueBinder
Ints binds parameter to slice of int
func (*ValueBinder) JSONUnmarshaler ¶
func (b *ValueBinder) JSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder
JSONUnmarshaler binds parameter to destination implementing json.Unmarshaler interface
func (*ValueBinder) MustBindUnmarshaler ¶
func (b *ValueBinder) MustBindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder
MustBindUnmarshaler requires parameter value to exist to bind to destination implementing BindUnmarshaler interface. Returns error when value does not exist
func (*ValueBinder) MustBindWithDelimiter ¶
func (b *ValueBinder) MustBindWithDelimiter(sourceParam string, dest interface{}, delimiter string) *ValueBinder
MustBindWithDelimiter requires parameter value to exist to bind destination by suitable conversion function. Delimiter is used before conversion to split parameter value to separate values
func (*ValueBinder) MustBool ¶
func (b *ValueBinder) MustBool(sourceParam string, dest *bool) *ValueBinder
MustBool requires parameter value to exist to bind to bool variable. Returns error when value does not exist
func (*ValueBinder) MustBools ¶
func (b *ValueBinder) MustBools(sourceParam string, dest *[]bool) *ValueBinder
MustBools requires parameter values to exist to bind to slice of bool variables. Returns error when values does not exist
func (*ValueBinder) MustByte ¶
func (b *ValueBinder) MustByte(sourceParam string, dest *byte) *ValueBinder
MustByte requires parameter value to exist to bind to byte variable. Returns error when value does not exist
func (*ValueBinder) MustCustomFunc ¶
func (b *ValueBinder) MustCustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder
MustCustomFunc requires parameter values to exist to bind with Func. Returns error when value does not exist.
func (*ValueBinder) MustDuration ¶
func (b *ValueBinder) MustDuration(sourceParam string, dest *time.Duration) *ValueBinder
MustDuration requires parameter value to exist to bind to time.Duration variable. Returns error when value does not exist
func (*ValueBinder) MustDurations ¶
func (b *ValueBinder) MustDurations(sourceParam string, dest *[]time.Duration) *ValueBinder
MustDurations requires parameter values to exist to bind to slice of time.Duration variables. Returns error when values does not exist
func (*ValueBinder) MustFloat32 ¶
func (b *ValueBinder) MustFloat32(sourceParam string, dest *float32) *ValueBinder
MustFloat32 requires parameter value to exist to bind to float32 variable. Returns error when value does not exist
func (*ValueBinder) MustFloat32s ¶
func (b *ValueBinder) MustFloat32s(sourceParam string, dest *[]float32) *ValueBinder
MustFloat32s requires parameter values to exist to bind to slice of float32 variables. Returns error when values does not exist
func (*ValueBinder) MustFloat64 ¶
func (b *ValueBinder) MustFloat64(sourceParam string, dest *float64) *ValueBinder
MustFloat64 requires parameter value to exist to bind to float64 variable. Returns error when value does not exist
func (*ValueBinder) MustFloat64s ¶
func (b *ValueBinder) MustFloat64s(sourceParam string, dest *[]float64) *ValueBinder
MustFloat64s requires parameter values to exist to bind to slice of float64 variables. Returns error when values does not exist
func (*ValueBinder) MustInt ¶
func (b *ValueBinder) MustInt(sourceParam string, dest *int) *ValueBinder
MustInt requires parameter value to exist to bind to int variable. Returns error when value does not exist
func (*ValueBinder) MustInt16 ¶
func (b *ValueBinder) MustInt16(sourceParam string, dest *int16) *ValueBinder
MustInt16 requires parameter value to exist to bind to int16 variable. Returns error when value does not exist
func (*ValueBinder) MustInt16s ¶
func (b *ValueBinder) MustInt16s(sourceParam string, dest *[]int16) *ValueBinder
MustInt16s requires parameter value to exist to bind to int16 slice variable. Returns error when value does not exist
func (*ValueBinder) MustInt32 ¶
func (b *ValueBinder) MustInt32(sourceParam string, dest *int32) *ValueBinder
MustInt32 requires parameter value to exist to bind to int32 variable. Returns error when value does not exist
func (*ValueBinder) MustInt32s ¶
func (b *ValueBinder) MustInt32s(sourceParam string, dest *[]int32) *ValueBinder
MustInt32s requires parameter value to exist to bind to int32 slice variable. Returns error when value does not exist
func (*ValueBinder) MustInt64 ¶
func (b *ValueBinder) MustInt64(sourceParam string, dest *int64) *ValueBinder
MustInt64 requires parameter value to exist to bind to int64 variable. Returns error when value does not exist
func (*ValueBinder) MustInt64s ¶
func (b *ValueBinder) MustInt64s(sourceParam string, dest *[]int64) *ValueBinder
MustInt64s requires parameter value to exist to bind to int64 slice variable. Returns error when value does not exist
func (*ValueBinder) MustInt8 ¶
func (b *ValueBinder) MustInt8(sourceParam string, dest *int8) *ValueBinder
MustInt8 requires parameter value to exist to bind to int8 variable. Returns error when value does not exist
func (*ValueBinder) MustInt8s ¶
func (b *ValueBinder) MustInt8s(sourceParam string, dest *[]int8) *ValueBinder
MustInt8s requires parameter value to exist to bind to int8 slice variable. Returns error when value does not exist
func (*ValueBinder) MustInts ¶
func (b *ValueBinder) MustInts(sourceParam string, dest *[]int) *ValueBinder
MustInts requires parameter value to exist to bind to int slice variable. Returns error when value does not exist
func (*ValueBinder) MustJSONUnmarshaler ¶
func (b *ValueBinder) MustJSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder
MustJSONUnmarshaler requires parameter value to exist to bind to destination implementing json.Unmarshaler interface. Returns error when value does not exist
func (*ValueBinder) MustString ¶
func (b *ValueBinder) MustString(sourceParam string, dest *string) *ValueBinder
MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist
func (*ValueBinder) MustStrings ¶
func (b *ValueBinder) MustStrings(sourceParam string, dest *[]string) *ValueBinder
MustStrings requires parameter values to exist to bind to slice of string variables. Returns error when value does not exist
func (*ValueBinder) MustTextUnmarshaler ¶
func (b *ValueBinder) MustTextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder
MustTextUnmarshaler requires parameter value to exist to bind to destination implementing encoding.TextUnmarshaler interface. Returns error when value does not exist
func (*ValueBinder) MustTime ¶
func (b *ValueBinder) MustTime(sourceParam string, dest *time.Time, layout string) *ValueBinder
MustTime requires parameter value to exist to bind to time.Time variable. Returns error when value does not exist
func (*ValueBinder) MustTimes ¶
func (b *ValueBinder) MustTimes(sourceParam string, dest *[]time.Time, layout string) *ValueBinder
MustTimes requires parameter values to exist to bind to slice of time.Time variables. Returns error when values does not exist
func (*ValueBinder) MustUint ¶
func (b *ValueBinder) MustUint(sourceParam string, dest *uint) *ValueBinder
MustUint requires parameter value to exist to bind to uint variable. Returns error when value does not exist
func (*ValueBinder) MustUint16 ¶
func (b *ValueBinder) MustUint16(sourceParam string, dest *uint16) *ValueBinder
MustUint16 requires parameter value to exist to bind to uint16 variable. Returns error when value does not exist
func (*ValueBinder) MustUint16s ¶
func (b *ValueBinder) MustUint16s(sourceParam string, dest *[]uint16) *ValueBinder
MustUint16s requires parameter value to exist to bind to uint16 slice variable. Returns error when value does not exist
func (*ValueBinder) MustUint32 ¶
func (b *ValueBinder) MustUint32(sourceParam string, dest *uint32) *ValueBinder
MustUint32 requires parameter value to exist to bind to uint32 variable. Returns error when value does not exist
func (*ValueBinder) MustUint32s ¶
func (b *ValueBinder) MustUint32s(sourceParam string, dest *[]uint32) *ValueBinder
MustUint32s requires parameter value to exist to bind to uint32 slice variable. Returns error when value does not exist
func (*ValueBinder) MustUint64 ¶
func (b *ValueBinder) MustUint64(sourceParam string, dest *uint64) *ValueBinder
MustUint64 requires parameter value to exist to bind to uint64 variable. Returns error when value does not exist
func (*ValueBinder) MustUint64s ¶
func (b *ValueBinder) MustUint64s(sourceParam string, dest *[]uint64) *ValueBinder
MustUint64s requires parameter value to exist to bind to uint64 slice variable. Returns error when value does not exist
func (*ValueBinder) MustUint8 ¶
func (b *ValueBinder) MustUint8(sourceParam string, dest *uint8) *ValueBinder
MustUint8 requires parameter value to exist to bind to uint8 variable. Returns error when value does not exist
func (*ValueBinder) MustUint8s ¶
func (b *ValueBinder) MustUint8s(sourceParam string, dest *[]uint8) *ValueBinder
MustUint8s requires parameter value to exist to bind to uint8 slice variable. Returns error when value does not exist
func (*ValueBinder) MustUints ¶
func (b *ValueBinder) MustUints(sourceParam string, dest *[]uint) *ValueBinder
MustUints requires parameter value to exist to bind to uint slice variable. Returns error when value does not exist
func (*ValueBinder) MustUnixTime ¶
func (b *ValueBinder) MustUnixTime(sourceParam string, dest *time.Time) *ValueBinder
MustUnixTime requires parameter value to exist to bind to time.Duration variable (in local time corresponding to the given Unix time). Returns error when value does not exist.
Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00
Note:
- time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
func (*ValueBinder) MustUnixTimeMilli ¶
func (b *ValueBinder) MustUnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder
MustUnixTimeMilli requires parameter value to exist to bind to time.Duration variable (in local time corresponding to the given Unix time in millisecond precision). Returns error when value does not exist.
Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00
Note:
- time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
func (*ValueBinder) MustUnixTimeNano ¶
func (b *ValueBinder) MustUnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder
MustUnixTimeNano requires parameter value to exist to bind to time.Duration variable (in local Time corresponding to the given Unix time value in nano second precision). Returns error when value does not exist.
Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00
Note:
- time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
- Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example.
func (*ValueBinder) String ¶
func (b *ValueBinder) String(sourceParam string, dest *string) *ValueBinder
String binds parameter to string variable
func (*ValueBinder) Strings ¶
func (b *ValueBinder) Strings(sourceParam string, dest *[]string) *ValueBinder
Strings binds parameter values to slice of string
func (*ValueBinder) TextUnmarshaler ¶
func (b *ValueBinder) TextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder
TextUnmarshaler binds parameter to destination implementing encoding.TextUnmarshaler interface
func (*ValueBinder) Time ¶
func (b *ValueBinder) Time(sourceParam string, dest *time.Time, layout string) *ValueBinder
Time binds parameter to time.Time variable
func (*ValueBinder) Times ¶
func (b *ValueBinder) Times(sourceParam string, dest *[]time.Time, layout string) *ValueBinder
Times binds parameter values to slice of time.Time variables
func (*ValueBinder) Uint ¶
func (b *ValueBinder) Uint(sourceParam string, dest *uint) *ValueBinder
Uint binds parameter to uint variable
func (*ValueBinder) Uint16 ¶
func (b *ValueBinder) Uint16(sourceParam string, dest *uint16) *ValueBinder
Uint16 binds parameter to uint16 variable
func (*ValueBinder) Uint16s ¶
func (b *ValueBinder) Uint16s(sourceParam string, dest *[]uint16) *ValueBinder
Uint16s binds parameter to slice of uint16
func (*ValueBinder) Uint32 ¶
func (b *ValueBinder) Uint32(sourceParam string, dest *uint32) *ValueBinder
Uint32 binds parameter to uint32 variable
func (*ValueBinder) Uint32s ¶
func (b *ValueBinder) Uint32s(sourceParam string, dest *[]uint32) *ValueBinder
Uint32s binds parameter to slice of uint32
func (*ValueBinder) Uint64 ¶
func (b *ValueBinder) Uint64(sourceParam string, dest *uint64) *ValueBinder
Uint64 binds parameter to uint64 variable
func (*ValueBinder) Uint64s ¶
func (b *ValueBinder) Uint64s(sourceParam string, dest *[]uint64) *ValueBinder
Uint64s binds parameter to slice of uint64
func (*ValueBinder) Uint8 ¶
func (b *ValueBinder) Uint8(sourceParam string, dest *uint8) *ValueBinder
Uint8 binds parameter to uint8 variable
func (*ValueBinder) Uint8s ¶
func (b *ValueBinder) Uint8s(sourceParam string, dest *[]uint8) *ValueBinder
Uint8s binds parameter to slice of uint8
func (*ValueBinder) Uints ¶
func (b *ValueBinder) Uints(sourceParam string, dest *[]uint) *ValueBinder
Uints binds parameter to slice of uint
func (*ValueBinder) UnixTime ¶
func (b *ValueBinder) UnixTime(sourceParam string, dest *time.Time) *ValueBinder
UnixTime binds parameter to time.Time variable (in local Time corresponding to the given Unix time).
Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00
Note:
- time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
func (*ValueBinder) UnixTimeMilli ¶
func (b *ValueBinder) UnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder
UnixTimeMilli binds parameter to time.Time variable (in local time corresponding to the given Unix time in millisecond precision).
Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00
Note:
- time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
func (*ValueBinder) UnixTimeNano ¶
func (b *ValueBinder) UnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder
UnixTimeNano binds parameter to time.Time variable (in local time corresponding to the given Unix time in nanosecond precision).
Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00
Note:
- time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
- Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example.