Documentation
¶
Index ¶
- func BaseType(typ reflect.Type) (_ reflect.Type, depth int)
- func BaseTypeOf(i any) reflect.Type
- func BaseValue(v reflect.Value) reflect.Value
- func BaseValueOf(i any) reflect.Value
- func Cast[T any](v any) (T, bool)
- func Equal(x, y any) bool
- func FullyQualifiedName(e any) string
- func IsEmpty(val reflect.Value) bool
- func IsValueNil(val reflect.Value) bool
- func IsZero(val reflect.Value) bool
- func Link(src, ptr any) (err error)
- func PointerOf(value reflect.Value) reflect.Value
- func RegisterEqual[T any](fn func(x, y T) bool) struct{}
- func SetValue(variable, value reflect.Value)
- func SymbolicName(e any) string
- func TypeOf[T any](i ...T) reflect.Type
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseTypeOf ¶
func BaseValueOf ¶
func Equal ¶
Equal will compare two value deeply. It looks for Equal method on the value as well. You can define how a type's value should be compared by using RegisterEqual.
Example ¶
package main import ( "go.llib.dev/frameless/pkg/reflectkit" ) func main() { reflectkit.Equal("a", "a") // true reflectkit.Equal("a", "b") // false }
func FullyQualifiedName ¶
Example ¶
package main import ( "fmt" "go.llib.dev/frameless/pkg/reflectkit" ) func main() { fmt.Println(reflectkit.FullyQualifiedName(Example{})) } type Example struct { Name string }
func IsValueNil ¶
func Link ¶
Link will make destination interface be linked with the src value.
Example ¶
package main import ( "go.llib.dev/frameless/pkg/reflectkit" ) func main() { var src = Example{Name: "Panda"} var dest Example if err := reflectkit.Link(src, &dest); err != nil { // handle err } } type Example struct { Name string }
func RegisterEqual ¶
func SymbolicName ¶
Example ¶
package main import ( "fmt" "go.llib.dev/frameless/pkg/reflectkit" ) func main() { fmt.Println(reflectkit.SymbolicName(Example{})) } type Example struct { Name string }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.