func Init(config *config.RedisConfig) (Redis, error) {
	db := Redis{}

	client := redis.NewClient(&redis.Options{
		Addr:     config.Host,
		Password: config.Password,
		DB:       config.DB,
	})

	// test if connection was established
	err := client.Ping().Err()
	if err != nil {
		return Redis{}, err
	}

	db.store = client
	log.Info().Str("host", config.Host).Msg("connected toredis")

	return db, nil
}
// Init creates a new db connection with given settings
Init creates a new db connection with given settings
// Init creates a new db connection with given settings
func Init(config *config.RedisConfig) (Redis, error) {
	db := Redis{}
	client := redis.NewClient(&redis.Options{
		Addr:     config.Host,
		Password: config.Password,
		DB:       config.DB,
	})
	err := client.Ping().Err()
	if err != nil {
		return Redis{}, err
	}
	db.store = client
	log.Info().Str("host", config.Host).Msg("connected toredis")
	return db, nil
}
func Init ( config * config . RedisConfig ) ( Redis , error ) { db := Redis { } client := redis . NewClient ( & redis . Options { Addr : config . Host , Password : config . Password , DB : config . DB , } ) err := client . Ping ( ) . Err ( ) if err != nil { return Redis { } , err } db . store = client log . Info ( ) . Str ( " " , config . Host ) . Msg ( " " ) return db , nil }
Init creates a new db connection with given settings
Init creates a new db connection with given settings
// test if connection was established