feat: use postgres

This commit is contained in:
Ilia Denisov
2026-04-26 20:34:39 +02:00
committed by GitHub
parent 48b0056b49
commit fe829285a6
365 changed files with 29223 additions and 24049 deletions
+31
View File
@@ -0,0 +1,31 @@
package redisconn
import (
"context"
"errors"
"fmt"
"time"
"github.com/redis/go-redis/v9"
)
// Ping bounds client.Ping under timeout and returns a wrapped error so
// startup failures are easy to spot in service logs.
//
// timeout is typically taken from Config.OperationTimeout.
func Ping(ctx context.Context, client *redis.Client, timeout time.Duration) error {
if client == nil {
return errors.New("ping redis: nil client")
}
if timeout <= 0 {
return errors.New("ping redis: timeout must be positive")
}
pingCtx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
if err := client.Ping(pingCtx).Err(); err != nil {
return fmt.Errorf("ping redis: %w", err)
}
return nil
}