From 8440b5e3c0cf8fb0f2ca006b69f1296107b642c0 Mon Sep 17 00:00:00 2001 From: Fenny <25108519+Fenny@users.noreply.github.com> Date: Thu, 5 Nov 2020 05:36:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=91=20update=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- memcache/memcache.go | 4 ++++ memory/memory.go | 4 ++++ mongodb/mongodb.go | 5 +++++ mysql/mysql.go | 4 ++++ postgres/postgres.go | 4 ++++ redis/redis.go | 4 ++++ sqlite3/fiber.sqlite3 | Bin 24576 -> 0 bytes sqlite3/sqlite3.go | 4 ++++ 8 files changed, 29 insertions(+) delete mode 100644 sqlite3/fiber.sqlite3 diff --git a/memcache/memcache.go b/memcache/memcache.go index 5ce43648..cab3a5b0 100644 --- a/memcache/memcache.go +++ b/memcache/memcache.go @@ -72,6 +72,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } item := s.acquireItem() item.Key = key item.Value = val diff --git a/memory/memory.go b/memory/memory.go index 6a0a3195..86bfe1b2 100644 --- a/memory/memory.go +++ b/memory/memory.go @@ -52,6 +52,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } var expire int64 if exp != 0 { expire = time.Now().Add(exp).Unix() diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index 8e9a9012..5faca20a 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -127,6 +127,11 @@ func (s *Storage) Get(key string) ([]byte, error) { // // document will be remove automatically if exp is set, based on MongoDB TTL Indexes func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } + filter := bson.M{"key": key} item := s.acquireItem() item.Key = key diff --git a/mysql/mysql.go b/mysql/mysql.go index 5d39be46..7e553ab9 100644 --- a/mysql/mysql.go +++ b/mysql/mysql.go @@ -118,6 +118,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } var expSeconds int64 if exp != 0 { expSeconds = time.Now().Add(exp).Unix() diff --git a/postgres/postgres.go b/postgres/postgres.go index de7ee7d3..369f12b4 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -138,6 +138,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } _, err := s.db.Exec(s.sqlInsert, key, utils.UnsafeString(val), time.Now().Add(exp).Unix()) return err } diff --git a/redis/redis.go b/redis/redis.go index 7b7ffb8a..86497adb 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -59,6 +59,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } return s.db.Set(context.Background(), key, val, exp).Err() } diff --git a/sqlite3/fiber.sqlite3 b/sqlite3/fiber.sqlite3 deleted file mode 100644 index df1ff74963767131138813038a61ce4326bc9220..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24576 zcmeI)zi!h&90%|_pX1misVi00O^Dl^NEDHRKnzH@sVNbz3&usQ7$R43Ay8^aja0_A zkHAat67U+l0E{3NhIU}!&WV#os7y#G^lQoX{rTCs-$%FDI_J?tzndjuEA73EGjWZ~ z5K74%AqXLdayR5&Z1b|97ZrJ?r^;s)56P9~_f`9Zl&VLhdNlpcX7-2ak7tFW9Rd)5 z00bZa0SG_<0uX=z1pb=9{w2N4Ij08~vv_km+3Id4z5GyWhMpUFB61gfPvlLaHf34X zi{z~kkKM3&&kbuguGhtbu(jfb8{)pVA%fLN1Z%!8mb|;}njZB@0AdXt>soQ>KI*m)sdIh>m`HV=9F}II?3Md>uvdb+K%63X?`bE>KiGlbaR?a!)+4FV8=00bZa0SG_<0uX=z z1Rwx`$rPw)I-fP4r_Xj4I%!g&MXe!gQz|9({C{kJoy_boY6w680uX=z1Rwwb2tWV= z5P$###sn00bZa0SG_<0uX=z1Rwwb2%JxW3M&@*=S%*F9{{K& z{}-q}*Z&;g^!oo3`y2iN;CxONWDNlbKmY;|fB*y_009U<00RGqz;M|=D@qNm%;xeB G0Db|1M9TjF diff --git a/sqlite3/sqlite3.go b/sqlite3/sqlite3.go index dab712db..c31f0162 100644 --- a/sqlite3/sqlite3.go +++ b/sqlite3/sqlite3.go @@ -117,6 +117,10 @@ func (s *Storage) Get(key string) ([]byte, error) { // Set key with value func (s *Storage) Set(key string, val []byte, exp time.Duration) error { + // Ain't Nobody Got Time For That + if len(val) <= 0 { + return nil + } var expSeconds int64 if exp != 0 { expSeconds = time.Now().Add(exp).Unix()