You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
581 B

4 years ago
package value
import (
"strconv"
"gitoa.ru/go-4devs/console/input/value/flag"
4 years ago
)
type Uint64 struct {
empty
4 years ago
Val []uint64
4 years ago
Flag flag.Flag
4 years ago
}
func (u *Uint64) Append(in string) error {
v, err := strconv.ParseUint(in, 10, 64)
if err != nil {
return err
}
u.Val = append(u.Val, v)
return nil
}
func (u *Uint64) Uint64() uint64 {
if !u.Flag.IsArray() && len(u.Val) == 1 {
return u.Val[0]
}
return 0
}
func (u *Uint64) Uint64s() []uint64 {
return u.Val
}
func (u *Uint64) Any() interface{} {
4 years ago
if u.Flag.IsArray() {
4 years ago
return u.Uint64s()
}
return u.Uint64()
}