From 3c4e62ce609c60d6c693ce509fc92948230c6d99 Mon Sep 17 00:00:00 2001 From: Stanly Date: Mon, 21 Sep 2020 17:07:28 +0800 Subject: [PATCH] Fix data get timestamp format --- types/data.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/types/data.go b/types/data.go index 61f3d0a..1488aed 100644 --- a/types/data.go +++ b/types/data.go @@ -321,12 +321,17 @@ func (data Data) MustGetBool(key string) bool { // GetTimestamp 取得時間戳記 func (data Data) GetTimestamp(key string) (Timestamp, error) { - value, err := data.GetInt64(key) + value, err := data.Get(key) if err != nil { return 0, err } - return Timestamp(value), nil + switch value.(type) { + case Timestamp: + return value.(Timestamp), nil + } + + return 0, ErrFormat } // MustGetTimestamp 強制取得時間戳記