|
@@ -38,6 +38,11 @@ func (t *Long) UnmarshalText(data []byte) error {
|
|
|
}
|
|
|
|
|
|
func (t Long) FromString(str string) Long {
|
|
|
+ return ParseLong(str)
|
|
|
+}
|
|
|
+
|
|
|
+func ParseLong(str string) Long {
|
|
|
+ str = strings.TrimSpace(str)
|
|
|
num, err := strconv.ParseInt(str, 10, 64)
|
|
|
if nil != err {
|
|
|
return 0
|
|
@@ -75,4 +80,4 @@ func (t *Long) Scan(value interface{}) error {
|
|
|
|
|
|
func (t Long) IsZero() bool {
|
|
|
return t == 0
|
|
|
-}
|
|
|
+}
|