Documentation ¶
Index ¶
- func BaseTypeOf(i interface{}) reflect.Type
- func BaseValueOf(i interface{}) reflect.Value
- func Cast[T any](v any) (T, bool)
- func FullyQualifiedName(e interface{}) string
- func IsValueEmpty(val reflect.Value) bool
- func IsValueNil(val reflect.Value) bool
- func Link(src, ptr interface{}) (err error)
- func SymbolicName(e interface{}) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseTypeOf ¶
func BaseValueOf ¶
func FullyQualifiedName ¶
func FullyQualifiedName(e interface{}) string
Example ¶
package main import ( "fmt" "github.com/adamluzsi/frameless/pkg/reflects" ) func main() { fmt.Println(reflects.FullyQualifiedName(any(nil))) }
Output:
func IsValueEmpty ¶
func IsValueNil ¶ added in v0.116.0
func Link ¶
func Link(src, ptr interface{}) (err error)
Link will make destination interface be linked with the src value.
Example ¶
package main import ( "fmt" "math/rand" "github.com/adamluzsi/frameless/pkg/reflects" ) type Example struct { Name string } var RandomName = fmt.Sprintf("%d", rand.Int()) func main() { var src = Example{Name: RandomName} var dest Example if err := reflects.Link(src, &dest); err != nil { // handle err } }
Output:
func SymbolicName ¶
func SymbolicName(e interface{}) string
Example ¶
package main import ( "github.com/adamluzsi/frameless/pkg/reflects" ) func main() { type T struct{} name := reflects.SymbolicName(T{}) _ = name }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.