helpers

package
v0.1.419 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 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 AddImpersonationHeader added in v0.0.329

func AddImpersonationHeader(header *http.Header, user string)

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 CopyHeader added in v0.0.329

func CopyHeader(header http.Header) http.Header

CopyHeader creates a copy of the given set of headers.

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 NewBoolean

func NewBoolean(value bool) *bool

NewBoolean allocates a new bool in the heap and returns a pointer to it.

func NewDate

func NewDate(value time.Time) *time.Time

NewDate allocates a new date in the heap and returns a pointer to it.

func NewFloat

func NewFloat(value float64) *float64

NewFloat allocates a new floating point value in the heap and returns an pointer to it.

func NewInteger

func NewInteger(value int) *int

NewInteger allocates a new integer in the heap and returns a pointer to it.

func NewIterator

func NewIterator(source interface{}) (iterator *jsoniter.Iterator, err error)

NewIterator creates a new JSON iterator that will read to the given source, which can be a slice of bytes, a string, a reader or an existing iterator.

func NewStream

func NewStream(writer io.Writer) *jsoniter.Stream

NewStream creates a new JSON stream that will write to the given writer.

func NewString

func NewString(value string) *string

NewString allocates a new string in the heap and returns a pointer to it.

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 PollContext

func PollContext(
	ctx context.Context,
	interval time.Duration,
	statuses []int,
	predicates []func(interface{}) bool,
	task func(context.Context) (int, interface{}, error),
) (result interface{}, err error)

PollContext repeatedly executes a task till it returns one of the given statuses and till the result satisfies all the given predicates.

func Segments

func Segments(path string) []string

Segments calculates the path segments for the given path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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