1
0
mirror of https://github.com/ebosas/microservices.git synced 2025-08-24 20:08:55 +02:00

Cache avoid null in JSON

This commit is contained in:
ebosas
2021-10-11 08:56:44 +03:00
parent 27e472d692
commit 306f1c7456

View File

@@ -37,7 +37,7 @@ func GetCache(c *redis.Client) (*Cache, error) {
return &Cache{}, fmt.Errorf("get redis: %v", err)
}
var msgsCache []Message
msgsCache := make([]Message, 0) // avoid null in JSON when empty
for _, messageJSON := range messages {
var message models.Message
err = json.Unmarshal([]byte(messageJSON), &message)