From 3721c9961641459faeae5aba8ab2865292d11b1f Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Thu, 5 Nov 2020 06:10:39 +0100 Subject: [PATCH] fix ErrNotExist --- mysql/mysql.go | 4 ++-- postgres/postgres.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql/mysql.go b/mysql/mysql.go index 75e43502..0558907d 100644 --- a/mysql/mysql.go +++ b/mysql/mysql.go @@ -109,8 +109,8 @@ func (s *Storage) Get(key string) ([]byte, error) { } // If the expiration time has already passed, then return nil - if exp <= time.Now().Unix() && exp != 0 { - return nil, nil + if exp != 0 && exp <= time.Now().Unix() { + return nil, ErrNotExist } return data, nil diff --git a/postgres/postgres.go b/postgres/postgres.go index abbb8d17..b20859f0 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -129,8 +129,8 @@ func (s *Storage) Get(key string) ([]byte, error) { } // If the expiration time has already passed, then return nil - if exp <= time.Now().Unix() && exp != 0 { - return nil, nil + if exp != 0 && exp <= time.Now().Unix() { + return nil, ErrNotExist } return data, nil