refactored data-types to reduce plugin sizes
This commit is contained in:
+4
-23
@@ -21,6 +21,10 @@ const (
|
||||
Base16
|
||||
)
|
||||
|
||||
type Formatter interface {
|
||||
ToString(options FmtOpt) string
|
||||
}
|
||||
|
||||
const (
|
||||
TruncateEllipsis = "(...)"
|
||||
MinTruncateSize = 10
|
||||
@@ -45,10 +49,6 @@ func GetFormatIndent(opt FmtOpt) int {
|
||||
return int(opt >> 16)
|
||||
}
|
||||
|
||||
type Formatter interface {
|
||||
ToString(options FmtOpt) string
|
||||
}
|
||||
|
||||
func Format(sb *strings.Builder, item any, opt FmtOpt) {
|
||||
if s, ok := item.(string); ok {
|
||||
sb.WriteByte('"')
|
||||
@@ -73,22 +73,3 @@ func GetFormatted(v any, opt FmtOpt) (text string) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
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 IsInteger(v) {
|
||||
name = "integer"
|
||||
} else if IsFloat(v) {
|
||||
name = "float"
|
||||
} else {
|
||||
name = fmt.Sprintf("%T", v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user