Documentation
¶
Overview ¶
Package utilities provides various utility functions and helpers for common operations. Copyright (c) APIMatic. All rights reserved.
Index ¶
- Constants
- func AssertEquals[T comparable](t *testing.T, expected, actual T)
- func AssertError(t *testing.T, err error)
- func AssertNoError(t *testing.T, err error)
- func DecodeResults[T any](decoder *json.Decoder) (T, error)
- func JsonDecoderToBooleanSlice(dec *json.Decoder) ([]bool, error)
- func JsonDecoderToIntSlice(dec *json.Decoder) ([]int, error)
- func JsonDecoderToString(dec *json.Decoder) (string, error)
- func JsonDecoderToStringSlice(dec *json.Decoder) ([]string, error)
- func NullableTimeToStringMap(dict map[string]*time.Time, format string) map[string]*string
- func PrepareQueryParams(queryParams url.Values, data map[string]interface{}) url.Values
- func TimeToStringMap(dict map[string]time.Time, format string) map[string]string
- func TimeToStringSlice(slice []time.Time, format string) []string
- func ToNullableTimeMap(dict interface{}, format string) (map[string]*time.Time, error)
- func ToTimeMap(dict interface{}, format string) (map[string]time.Time, error)
- func ToTimeSlice(slice interface{}, format string) ([]time.Time, error)
- func UpdateUserAgent(userAgent string) string
Constants ¶
const DEFAULT_DATE = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
func AssertEquals ¶ added in v0.0.15
func AssertEquals[T comparable](t *testing.T, expected, actual T)
Asserts that both values are equal. This may not apply to all types.
func AssertError ¶ added in v0.0.15
Asserts that an error is returned (i.e. not nil).
func AssertNoError ¶ added in v0.0.15
Asserts that no error is returned (i.e. nil).
func DecodeResults ¶
DecodeResults decodes JSON data from the provided json.Decoder into a given type T.
func JsonDecoderToBooleanSlice ¶
JsonDecoderToBooleanSlice decodes a JSON array from the provided json.Decoder into a bool slice.
func JsonDecoderToIntSlice ¶
JsonDecoderToIntSlice decodes a JSON array from the provided json.Decoder into an int slice.
func JsonDecoderToString ¶
JsonDecoderToString decodes a JSON value from the provided json.Decoder into a string.
func JsonDecoderToStringSlice ¶
JsonDecoderToStringSlice decodes a JSON array from the provided json.Decoder into a string slice.
func NullableTimeToStringMap ¶
NullableTimeToStringMap converts a map with nullable time.Time values to a map with nullable strings using the specified format.
func PrepareQueryParams ¶
PrepareQueryParams adds key-value pairs from the data map to the existing URL query parameters.
func TimeToStringMap ¶
TimeToStringMap converts a map with time.Time values to a map with strings using the specified format.
func TimeToStringSlice ¶
TimeToStringSlice converts a slice of time.Time values to a slice of strings using the specified format.
func ToNullableTimeMap ¶
ToNullableTimeMap converts a map with nullable string or int64 values to a map with nullable time.Time values using the specified format.
func ToTimeMap ¶
ToTimeMap converts a map with string or int64 values to a map with time.Time values using the specified format.
func ToTimeSlice ¶
ToTimeSlice converts a slice of strings or int64 values to a slice of time.Time values using the specified format.
func UpdateUserAgent ¶
UpdateUserAgent replaces placeholders in the user agent string with the actual values.
Types ¶
This section is empty.