Skip to content

Latest commit

 

History

History

fxredis

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Fx Redis Module

ci go report codecov Deps PkgGoDev

Fx module for Redis.

Overview

This module provides to your Fx application a redis.Client, that you can inject anywhere to interact with Redis.

Installation

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

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}

Testing

In test mode, an additional redismock.ClientMock is provided.

See example.