helpers

package
v0.1.48 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHeader

func AddHeader(header *http.Header, name string, value interface{})

AddHeader creates the given set of headers if needed, and then adds the given header:

func AddValue

func AddValue(query *url.Values, name string, value interface{})

AddValue creates the given set of query parameters if needed, an then adds the given parameter.

func CopyQuery

func CopyQuery(query url.Values) url.Values

CopyQuery creates a copy of the given set of query parameters.

func CopyValues

func CopyValues(values []string) []string

CopyValues copies a slice of strings.

func NewDecoder added in v0.1.30

func NewDecoder(source interface{}) (decoder *json.Decoder, err error)

NewDecoder creates a new JSON decoder from the given source. The source can be a slice of bytes, a string, a reader or a JSON decoder.

func NewEncoder added in v0.1.30

func NewEncoder(target interface{}) (encoder *json.Encoder, err error)

NewEncoder creates a new JSON encoder from the given target. The target can be a a writer or a JSON encoder.

func ParseBoolean

func ParseBoolean(query url.Values, parameterName string) (*bool, error)

ParseBoolean reads a string and parses it to boolean, if an error occurred it returns a non-nil error.

func ParseDate

func ParseDate(query url.Values, parameterName string) (*time.Time, error)

ParseDate reads a string and parses it to a time.Time, if an error occurred it returns a non-nil error.

func ParseFloat

func ParseFloat(query url.Values, parameterName string) (*float64, error)

ParseFloat reads a string and parses it to float, if an error occurred it returns a non-nil error.

func ParseInteger

func ParseInteger(query url.Values, parameterName string) (*int, error)

ParseInteger reads a string and parses it to integer, if an error occurred it returns a non-nil error.

func ParseString

func ParseString(query url.Values, parameterName string) (*string, error)

ParseString returns a pointer to the string and nil error.

func Segments

func Segments(path string) []string

Segments calculates the path segments for the given path.

func SetHeader

func SetHeader(header http.Header, metric string) http.Header

SetHeader creates a copy of the given set of headers, and adds the header containing the given metrics path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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