args/type.go

31 lines
367 B
Go

package args
import (
"fmt"
"time"
)
type Type int
const (
INT = Type(iota)
STRING = Type(iota)
BOOL = Type(iota)
DURATION = Type(iota)
)
func (t Type) String() string {
var i interface{} = nil
switch t {
case INT:
i = 1
case STRING:
i = ""
case BOOL:
i = false
case DURATION:
i = time.Duration(0)
}
return fmt.Sprintf("%T", i)
}