github.com/keysonzzz/kmg@v0.0.0-20151121023212-05317bfd7d39/kmgType/IntType.go (about) 1 package kmgType 2 3 import ( 4 "reflect" 5 "strconv" 6 //"fmt" 7 ) 8 9 type IntType struct { 10 reflectTypeGetterImp 11 saveScaleFromStringer 12 saveScaleEditabler 13 } 14 15 func (t *IntType) ToString(v reflect.Value) string { 16 s := strconv.FormatInt(v.Int(), 10) 17 return s 18 } 19 func (t *IntType) SaveScale(v reflect.Value, value string) error { 20 i, err := strconv.ParseInt(value, 10, t.GetReflectType().Bits()) 21 if err != nil { 22 return err 23 } 24 v.SetInt(i) 25 return nil 26 }