httputil

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStruct = errors.New("Unmarshal() expects struct input. ")

Functions

func GetContentType

func GetContentType(header http.Header) string

func MapToURLValues

func MapToURLValues(m map[string]string) (vals url.Values)

func UnmarshalURLValues

func UnmarshalURLValues(values url.Values, s interface{}) error

UnmarshalURLValues url.Values to struct

Types

type Map

type Map[KT comparable, VT any] map[KT]VT

func (Map[KT, VT]) String

func (m Map[KT, VT]) String() string

type Option

type Option func(value *Value)

func Default

func Default(dftVal string) Option

func SplitFunc

func SplitFunc(f func(v Value) []string) Option

type URL

type URL url.URL

func (*URL) Set

func (u *URL) Set(s string) error

func (URL) String

func (u URL) String() string

func (*URL) Type

func (u *URL) Type() string

type Value

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

func NewValue

func NewValue(val string, options ...Option) *Value

func (Value) Bool

func (v Value) Bool() (bool, error)

func (Value) Bytes

func (v Value) Bytes() []byte

func (*Value) Default

func (v *Value) Default(dftVal string) *Value

func (Value) Duration

func (v Value) Duration() (time.Duration, error)

func (Value) Durations

func (v Value) Durations(seps ...byte) (vals []time.Duration, err error)

func (Value) Float32

func (v Value) Float32() (float32, error)

func (Value) Float32s

func (v Value) Float32s(seps ...byte) (vals []float32, err error)

func (Value) Float64

func (v Value) Float64() (float64, error)

func (Value) Float64s

func (v Value) Float64s(seps ...byte) (vals []float64, err error)

func (Value) Int

func (v Value) Int() (int, error)

func (Value) Int32s

func (v Value) Int32s(seps ...byte) (vals []int, err error)

func (Value) Int64

func (v Value) Int64() (int64, error)

func (Value) Int64s

func (v Value) Int64s(seps ...byte) (vals []int64, err error)

func (*Value) Set

func (v *Value) Set(val string) *Value

func (Value) Split

func (v Value) Split(seps ...byte) Values

func (Value) String

func (v Value) String() string

func (Value) Strings

func (v Value) Strings(seps ...byte) []string

func (Value) Time

func (v Value) Time(layout string) (time.Time, error)

type Values

type Values []Value

func (Values) Durations

func (v Values) Durations() (vals []time.Duration, err error)

func (Values) Float32s

func (v Values) Float32s() (vals []float32, err error)

func (Values) Float64s

func (v Values) Float64s() (vals []float64, err error)

func (Values) Int64s

func (v Values) Int64s() (vals []int64, err error)

func (Values) Ints

func (v Values) Ints() (vals []int, err error)

func (Values) Strings

func (v Values) Strings() (vals []string)

Jump to

Keyboard shortcuts

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