refactored data-types to reduce plugin sizes
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2024-2026 Celestino Amoroso (celestino.amoroso@gmail.com).
|
||||
// All rights reserved.
|
||||
|
||||
// typer.go
|
||||
package kern
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Typer interface {
|
||||
TypeName() string
|
||||
}
|
||||
|
||||
func TypeName(v any) (name string) {
|
||||
if v == nil {
|
||||
name = "nil"
|
||||
} else if typer, ok := v.(Typer); ok {
|
||||
name = typer.TypeName()
|
||||
} else if _, ok := v.(int64); ok {
|
||||
name = "integer"
|
||||
} else if _, ok := v.(float64); ok {
|
||||
name = "float"
|
||||
} else {
|
||||
name = fmt.Sprintf("%T", v)
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user