37 lines
473 B
Go
Executable File
37 lines
473 B
Go
Executable File
package args
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type Type int
|
|
|
|
const (
|
|
INT = Type(iota)
|
|
STRING = Type(iota)
|
|
BOOL = Type(iota)
|
|
DURATION = Type(iota)
|
|
TIME = Type(iota)
|
|
FLOAT = 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)
|
|
case TIME:
|
|
i = time.Time{}
|
|
case FLOAT:
|
|
i = float32(0)
|
|
}
|
|
return fmt.Sprintf("%T", i)
|
|
}
|