Documentation
¶
Index ¶
- Variables
- func AssertType[T any](v any) (T, bool)
- func CanCast[T any](v any) bool
- func CanElem(k reflect.Kind) bool
- func Clone[T any](src T) (dst T)
- func DeepCopy(v, x reflect.Value)
- func Deref(t reflect.Type) reflect.Type
- func HackField(v any, i int) reflect.Value
- func HackFieldByName(v any, name string) reflect.Value
- func Indirect(v any) reflect.Value
- func IndirectNew(v any) reflect.Value
- func IsBytes(v any) bool
- func IsFloat(v any) bool
- func IsInteger(v any) bool
- func IsNumeric(v any) bool
- func IsZero(v any) bool
- func MustAssertType[T any](v any) T
- func New(t reflect.Type) reflect.Value
- func NewElem(t reflect.Type) reflect.Value
- func Typename(rt reflect.Type) string
- type Flag
- type Flags
- type ZeroChecker
Constants ¶
This section is empty.
Variables ¶
var TypeZeroChecker = reflect.TypeFor[ZeroChecker]()
Functions ¶
func AssertType ¶ added in v0.0.34
func IndirectNew ¶
IndirectNew returns the indirect value of v this function is safe and WILL NOT trigger panic. if the input is invalid, InvalidValue returns. validation of return is recommended.
func IsZero ¶
IsZero checks whether the given value is zero or its underlying value is zero
If the value implements the ZeroChecker interface, IsZero will use its IsZero method to determine zero-ness. Special handling is provided for slices, maps, strings, and channels, which are considered zero if their length is zero.
func MustAssertType ¶ added in v0.0.34
Types ¶
type Flag ¶ added in v0.1.0
Flag represents a single tag value with optional key-value options. For example, the tag `name:"field,opt1,opt2=v2"` will be parsed into: {Name: "field", Options: [][2]string{{"opt1": ""}, {"opt2": "v2"}}}
type Flags ¶ added in v0.1.0
func ParseFlags ¶ added in v0.1.0
ParseFlags parses struct tag annotations into a structured Flags map. It supports tag formats like: `key:"value,opt1,opt2=v2"`. Each key-value pair in the tag is processed into a Flag with Value and Options. Conflicting tags (i.e., duplicate keys) will be detected and removed. The function also handles quoted values and options with or without values.
type ZeroChecker ¶ added in v0.1.0
type ZeroChecker interface {
IsZero() bool
}