Documentation ¶
Index ¶
- func Contains(slice interface{}, value interface{}) bool
- func ContainsStr(slice []string, value string) bool
- func IndexOf(slice interface{}, value interface{}) int
- func IndexOfStr(slice []string, value string) int
- func RemoveHiddenFields(model interface{})
- func SliceEqual(first interface{}, second interface{}) bool
- func ToFloat64(value interface{}) (float64, error)
- func ToString(value interface{}) string
- type HeaderValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains(slice interface{}, value interface{}) bool
Contains check if a slice contains a value.
func ContainsStr ¶ added in v2.6.0
ContainsStr check if a string slice contains a value. Prefer using this helper instead of Contains for better performance.
func IndexOf ¶ added in v2.5.0
func IndexOf(slice interface{}, value interface{}) int
IndexOf get the index of the given value in the given slice, or -1 if not found.
func IndexOfStr ¶ added in v2.6.0
IndexOfStr get the index of the given value in the given string slice, or -1 if not found. Prefer using this helper instead of IndexOf for better performance.
func RemoveHiddenFields ¶ added in v2.9.0
func RemoveHiddenFields(model interface{})
RemoveHiddenFields if the given model is a struct pointer. All fields marked with the tag `model:"hide"` will be set to their zero value.
For example, this allows to send user models to the client without their password field.
func SliceEqual ¶
func SliceEqual(first interface{}, second interface{}) bool
SliceEqual check if two generic slices are the same.
Types ¶
type HeaderValue ¶
HeaderValue represent a value and its quality value (priority) in a multi-values HTTP header.
func ParseMultiValuesHeader ¶
func ParseMultiValuesHeader(header string) []HeaderValue
ParseMultiValuesHeader parses multi-values HTTP headers, taking the quality values into account. The result is a slice of values sorted according to the order of priority.
See: https://developer.mozilla.org/en-US/docs/Glossary/Quality_values
For the following header:
"text/html,text/*;q=0.5,*/*;q=0.7"
then
[{text/html 1} {*/* 0.7} {text/* 0.5}]