cast

package
v0.0.0-...-b4a383b Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 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 PopulateStruct

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

PopulateStruct populates the properties to the structure's field. nolint:goerr113

func ToAny

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

ToAny cast string a any type.

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