diff --git a/constant.go b/constant.go new file mode 100644 index 0000000..5780d6f --- /dev/null +++ b/constant.go @@ -0,0 +1,6 @@ +package fcm + +const ( + logDBName = "log_fcm" + maxTokensPerSend = 1000 +) diff --git a/helper.go b/helper.go index 5836c63..c823526 100644 --- a/helper.go +++ b/helper.go @@ -6,11 +6,6 @@ import ( "github.com/thoas/go-funk" ) -const ( - logDBName = "fcm" - maxTokensPerSend = 1000 -) - // base64Decode ... func base64Decode(text string) []byte { sDec, _ := b64.StdEncoding.DecodeString(text) diff --git a/log.go b/log.go index 37adbc6..81adeb7 100644 --- a/log.go +++ b/log.go @@ -35,7 +35,7 @@ func (s Service) saveLog(doc Log) { // Assign data doc.ID = mongodb.NewObjectID() - doc.CreatedAt = Now() + doc.CreatedAt = now() if _, err := s.DB.Collection(logDBName).InsertOne(ctx, doc); err != nil { pretty.Println("*** FCM create log error", err.Error()) diff --git a/time.go b/time.go index 0d2bfdd..ab69cd6 100644 --- a/time.go +++ b/time.go @@ -10,14 +10,13 @@ import "time" const timezoneHCM = "Asia/Ho_Chi_Minh" -// GetHCMLocation ... -func GetHCMLocation() *time.Location { +// getHCMLocation ... +func getHCMLocation() *time.Location { l, _ := time.LoadLocation(timezoneHCM) return l } - -// Now ... -func Now() time.Time { - return time.Now().In(GetHCMLocation()) +// now ... +func now() time.Time { + return time.Now().In(getHCMLocation()) }