包装类型支持转为时间类型
This commit is contained in:
13
int.go
13
int.go
@ -10,6 +10,7 @@ package wrapper
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Int int类型
|
||||
@ -19,6 +20,18 @@ import (
|
||||
// Date : 13:57 2023/5/5
|
||||
type Int int64
|
||||
|
||||
// ToDuration ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 20:33 2023/9/4
|
||||
func (i Int) ToDuration(timeUnit time.Duration) DurationResult {
|
||||
return DurationResult{
|
||||
Value: time.Duration(i.ToInt64().Value) * timeUnit,
|
||||
Err: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// ToInt8 ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
|
Reference in New Issue
Block a user