Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNilConfig = errors.New("redis config cannot be nil")
)
Functions ¶
This section is empty.
Types ¶
type ConnConfig ¶ added in v0.5.0
type ConnConfig struct {
// contains filtered or unexported fields
}
ConnConfig struct
func NewConnConfig ¶ added in v0.5.0
func NewConnConfig(uri, password string, database int) *ConnConfig
NewConnConfig creates a new Redis config
Parameters:
- uri: the URI
- password: the password
- database: the database
Returns:
*ConnConfig: the Redis config
func (ConnConfig) Database ¶ added in v0.5.0
func (c ConnConfig) Database() int
Database returns the database
Returns:
int: the database
func (ConnConfig) Password ¶ added in v0.5.0
func (c ConnConfig) Password() string
Password returns the password
Returns:
string: the password
func (ConnConfig) URI ¶ added in v0.5.0
func (c ConnConfig) URI() string
URI returns the URI
Returns:
string: the URI
type ConnHandler ¶ added in v0.5.0
type ConnHandler interface {
Connect() (*redis.Client, error)
Client() (*redis.Client, error)
Disconnect()
}
ConnHandler interface
type DefaultConnHandler ¶ added in v0.5.0
type DefaultConnHandler struct {
// contains filtered or unexported fields
}
DefaultConnHandler struct
func NewDefaultConnHandler ¶ added in v0.5.0
func NewDefaultConnHandler(config Config) ( *DefaultConnHandler, error, )
NewDefaultConnHandler creates a new connection
Parameters:
- config Config: configuration for the connection
Returns:
- *DefaultConnHandler: connection handler - error: error if the config is nil
func (*DefaultConnHandler) Client ¶ added in v0.5.0
func (d *DefaultConnHandler) Client() (*redis.Client, error)
Client returns the Redis client
Returns:
- *redis.Client: Redis client - error: error if the connection is not established
func (*DefaultConnHandler) Connect ¶ added in v0.5.0
func (d *DefaultConnHandler) Connect() (*redis.Client, error)
Connect returns a new Redis client
Returns:
- *redis.Client: Redis client - error: error if the connection fails or is already established
func (*DefaultConnHandler) Disconnect ¶ added in v0.5.0
func (d *DefaultConnHandler) Disconnect()
Disconnect closes the Redis client connection