This module provides to your Fx application a redis.Client,
that you can inject
anywhere to interact with Redis.
Install the module:
go get github.com/ankorstore/yokai-contrib/fxredis
Then activate them in your application bootstrapper:
// internal/bootstrap.go
package internal
import (
"github.com/ankorstore/yokai-contrib/fxredis"
"github.com/ankorstore/yokai/fxcore"
)
var Bootstrapper = fxcore.NewBootstrapper().WithOptions(
// load modules
fxredis.FxRedisModule,
// ...
)
Configuration reference:
# ./configs/config.yaml
app:
name: app
env: dev
version: 0.1.0
debug: true
modules:
redis:
dsn: redis://${REDIS_USER}:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}
In test
mode, an additional redismock.ClientMock is provided.
See example.