univ

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int16Slice

func Int16Slice(s interface{}) []int16

Int16Slice returns a slice of int16. For more info refer to Slice types Int16Slice() method.

func Int32Slice

func Int32Slice(s interface{}) []int32

Int32Slice returns a slice of int32. For more info refer to Slice types Int32Slice() method.

func Int64Slice

func Int64Slice(s interface{}) []int64

Int64Slice returns a slice of int64. For more info refer to Slice types Int64Slice() method.

func Int8Slice

func Int8Slice(s interface{}) []int8

Int8Slice returns a slice of int8. For more info refer to Slice types Int8Slice() method.

func IntSlice

func IntSlice(s interface{}) []int

IntSlice returns a slice of int. For more info refer to Slice types IntSlice() method.

func KeysIntOfMap

func KeysIntOfMap(m interface{}) []int64

KeysIntOfMap 获取map m的key的切片,要求m为map且key为数值 (int,int8,int16,int32,int64,uint,uint8,uint16,uint32,uint64).

func KeysOfMap

func KeysOfMap(m interface{}) []string

KeysOfMap 获取map m的key的切片,要求m为map且key为字符串(string).

func StructStringSlice

func StructStringSlice(s interface{}, fieldName string) []string

StructStringSlice returns a slice of int64. For more info refer to Slice types StructStringSlice() method.

func StructsInt64Slice

func StructsInt64Slice(s interface{}, fieldName string) []int64

StructsInt64Slice returns a slice of int64. For more info refer to Slice types StructInt64Slice() method.

func StructsIntSlice

func StructsIntSlice(s interface{}, fieldName string) []int

StructsIntSlice returns a slice of int. For more info refer to Slice types StructIntSlice() method.

func StructsUint64Slice

func StructsUint64Slice(s interface{}, fieldName string) []uint64

StructsUint64Slice returns a slice of int64. For more info refer to Slice types StructUint64Slice() method.

func StructsUintSlice

func StructsUintSlice(s interface{}, fieldName string) []uint

StructsUintSlice returns a slice of int. For more info refer to Slice types v() method.

func Uint16Slice

func Uint16Slice(s interface{}) []uint16

Uint16Slice returns a slice of uint16. For more info refer to Slice types Uint16Slice() method.

func Uint32Slice

func Uint32Slice(s interface{}) []uint32

Uint32Slice returns a slice of uint32. For more info refer to Slice types Uint32Slice() method.

func Uint64Slice

func Uint64Slice(s interface{}) []uint64

Uint64Slice returns a slice of uint64. For more info refer to Slice types Uint64Slice() method.

func Uint8Slice

func Uint8Slice(s interface{}) []uint8

Uint8Slice returns a slice of uint8. For more info refer to Slice types Uint8Slice() method.

func UintSlice

func UintSlice(s interface{}) []uint

UintSlice returns a slice of uint. For more info refer to Slice types UintSlice() method.

Types

type Slice

type Slice struct {
	// contains filtered or unexported fields
}

Slice hold a slice reflect.value

func NewSlice

func NewSlice(s interface{}) *Slice

NewSlice returns a new *Slice with the slice s. It panics if the s's kind is not slice.

func (*Slice) Int16Slice

func (sf *Slice) Int16Slice() []int16

Int16Slice extracts the given s slice's every element, which is integer or float, to []int16 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) Int32Slice

func (sf *Slice) Int32Slice() []int32

Int32Slice extracts the given s slice's every element, which is integer or float, to []int32 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) Int64Slice

func (sf *Slice) Int64Slice() []int64

Int64Slice extracts the given s slice's every element, which is integer or float, to []int64 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) Int8Slice

func (sf *Slice) Int8Slice() []int8

Int8Slice extracts the given s slice's every element, which is integer or float, to []int8 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) IntSlice

func (sf *Slice) IntSlice() []int

IntSlice extracts the given s slice's every element, which is integer or float, to []int by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) Name

func (sf *Slice) Name() string

Name returns the slice's type name within its package. For more info refer to Name() function.

func (*Slice) StructInt64Slice

func (sf *Slice) StructInt64Slice(fieldName string) []int64

StructInt64Slice extracts the given s slice's every element, which is struct, to []int64 by the field. It panics if the s's element is not struct, or field is not exits, or the value of field is not integer.

func (*Slice) StructIntSlice

func (sf *Slice) StructIntSlice(fieldName string) []int

StructIntSlice extracts the given s slice's every element, which is struct, to []int by the field. It panics if the s's element is not struct, or field is not exits, or the value of field is not integer.

func (*Slice) StructStringSlice

func (sf *Slice) StructStringSlice(fieldName string) []string

StructStringSlice extracts the given s slice's every element, which is struct, to []string by the field. It panics if the s's element is not struct, or field is not exits, or the value of field is not integer or string.

func (*Slice) StructUint64Slice

func (sf *Slice) StructUint64Slice(fieldName string) []uint64

StructUint64Slice extracts the given s slice's every element, which is struct, to []int64 by the field. It panics if the s's element is not struct, or field is not exits, or the value of field is not integer.

func (*Slice) StructUintSlice

func (sf *Slice) StructUintSlice(fieldName string) []uint

StructUintSlice extracts the given s slice's every element, which is struct, to []uint by the field. It panics if the s's element is not struct, or field is not exits, or the value of field is not integer.

func (*Slice) Uint16Slice

func (sf *Slice) Uint16Slice() []uint16

Uint16Slice extracts the given s slice's every element, which is integer or float, to []uint16 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) Uint32Slice

func (sf *Slice) Uint32Slice() []uint32

Uint32Slice extracts the given s slice's every element, which is integer or float, to []uint32 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) Uint64Slice

func (sf *Slice) Uint64Slice() []uint64

Uint64Slice extracts the given s slice's every element, which is integer or float, to []uint64 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) Uint8Slice

func (sf *Slice) Uint8Slice() []uint8

Uint8Slice extracts the given s slice's every element, which is integer or float, to []uint8 by the field. It panics if the s's element is not integer or float, or field is not invalid.

func (*Slice) UintSlice

func (sf *Slice) UintSlice() []uint

UintSlice extracts the given s slice's every element, which is integer or float, to []uint by the field. It panics if the s's element is not integer or float, or field is not invalid.

type Values

type Values map[string][]string

Values maps a string key to a list of values. It is typically used for query parameters and form values. Unlike in the http.Header map, the keys in a Values map are case-sensitive.

func ParseValue

func ParseValue(values, separator, delimiter string) Values

ParseValue parses the URL-encoded query string and returns a map listing the values specified for each key. ParseQuery always returns a non-nil map containing all the valid query parameters found; err describes the first decoding error encountered, if any.

func (Values) Add

func (v Values) Add(key, value string)

Add adds the value to key. It appends to any existing values associated with key.

func (Values) Del

func (v Values) Del(key string)

Del deletes the values associated with key.

func (Values) Encode

func (v Values) Encode(separator, delimiter string) string

Encode encodes the values into form (separator="=" delimiter="&") ("bar=baz&foo=quux") sorted by key.

func (Values) Get

func (v Values) Get(key string) string

Get gets the first value associated with the given key. If there are no values associated with the key, Get returns the empty string. To access multiple values, use the map directly.

func (Values) Set

func (v Values) Set(key, value string)

Set sets the key to value. It replaces any existing values.

Jump to

Keyboard shortcuts

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