conv

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 9 Imported by: 2 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TimeFormatUnixTimestamp                 = "unix-timestamp"
	TimeFormatUnixMilliTimestamp            = "unix-milli-timestamp"
	TimeFormatUnixTimestampString           = "unix-timestamp-string"
	TimeFormatUnixMilliTimestampString      = "unix-milli-timestamp-string"
	TimeFormatFloatUnixTimestamp            = "float-unix-timestamp"
	TimeFormatFloatUnixMilliTimestamp       = "float-unix-milli-timestamp"
	TimeFormatFloatUnixTimestampString      = "float-unix-timestamp-string"
	TimeFormatFloatUnixMilliTimestampString = "float-unix-milli-timestamp-string"
)

Variables

This section is empty.

Functions

func BinaryUnmarshalerHookFunc added in v1.2.3

func BinaryUnmarshalerHookFunc() mapstructure.DecodeHookFuncType

BinaryUnmarshalerHookFunc returns a DecodeHookFunc that applies strings to the UnmarshalBinary function, when the target type implements the encoding.BinaryUnmarshaler interface

func DecodeQuery added in v1.2.3

func DecodeQuery(query string, dst interface{}, config *mapstructure.DecoderConfig, fs ...mapstructure.DecodeHookFunc) error

DecodeQuery takes an input query string and uses reflection to translate it to the dst structure. dst must be a pointer to a map or struct.

func DecodeURLValues added in v1.2.3

func DecodeURLValues(u url.Values, dst interface{}, config *mapstructure.DecoderConfig, fs ...mapstructure.DecodeHookFunc) error

DecodeURLValues takes an input url.Values and uses reflection to translate it to the dst structure. dst must be a pointer to a map or struct.

func DefaultDecodeHookFuncs added in v1.2.3

func DefaultDecodeHookFuncs() []mapstructure.DecodeHookFunc

func JSON

func JSON[sT any, dT any](src sT, dst *dT) error

func StringToBaseTypeHookFunc added in v1.2.3

func StringToBaseTypeHookFunc(fv reflect.Value, tv reflect.Value) (interface{}, error)

func StringToTimeHookFunc added in v1.2.3

func StringToTimeHookFunc(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error)

StringToTimeHookFunc returns a DecodeHookFunc that converts strings to time.Time.

func URLValuesHookFunc added in v1.2.3

Types

type Time added in v1.2.3

type Time struct {
	time.Time
	Format string
}

func (Time) MarshalJSON added in v1.2.3

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON added in v1.2.3

func (t *Time) UnmarshalJSON(raw []byte) error

Jump to

Keyboard shortcuts

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