cast

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidValue = reflect.Value{}
)

nolint:gochecknoglobals

Functions

func To

func To(s string, t reflect.Type) (reflect.Value, error)

To cast string a any type.

func ToStruct

func ToStruct(b interface{}, tagName string, getter func(filedName, tagValue string) (interface{}, bool)) error

ToStruct populates the properties to the structure's field.

func TryAnyCase

func TryAnyCase(name string, getter func(string) (interface{}, bool)) (interface{}, bool)

TryAnyCase tries to find value by name in any-case.

func TryFind

func TryFind(filedName, tagValue string, getter func(string) (interface{}, bool)) (interface{}, bool)

TryFind tries to find value by field name or tag value.

Types

type Caster

type Caster func(s string, asPtr bool) (reflect.Value, error)

Caster defines the function prototype for cast string a any type.

Jump to

Keyboard shortcuts

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