github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/store/factory/factory.go (about)

     1  package factory
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/projecteru2/core/store"
     7  	"github.com/projecteru2/core/store/etcdv3"
     8  	"github.com/projecteru2/core/store/redis"
     9  	"github.com/projecteru2/core/types"
    10  )
    11  
    12  // NewStore creates a store
    13  func NewStore(config types.Config, t *testing.T) (stor store.Store, err error) {
    14  	switch config.Store {
    15  	case types.Redis:
    16  		stor, err = redis.New(config, t)
    17  	default:
    18  		stor, err = etcdv3.New(config, t)
    19  	}
    20  	return stor, err
    21  }