redis

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package redis provides a client for interacting with Redis key-value stores.This package allows creating and managing Redis clients, executing Redis commands, and handling connections to Redis databases.

Package redis is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HostName string
	Port     int
	Options  *redis.Options
}

type Metrics added in v0.3.0

type Metrics interface {
	RecordHistogram(ctx context.Context, name string, value float64, labels ...string)
}

type MockMetrics added in v0.3.0

type MockMetrics struct {
	// contains filtered or unexported fields
}

MockMetrics is a mock of Metrics interface.

func NewMockMetrics added in v0.3.0

func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics

NewMockMetrics creates a new mock instance.

func (*MockMetrics) EXPECT added in v0.3.0

func (m *MockMetrics) EXPECT() *MockMetricsMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockMetrics) RecordHistogram added in v0.3.0

func (m *MockMetrics) RecordHistogram(ctx context.Context, name string, value float64, labels ...string)

RecordHistogram mocks base method.

type MockMetricsMockRecorder added in v0.3.0

type MockMetricsMockRecorder struct {
	// contains filtered or unexported fields
}

MockMetricsMockRecorder is the mock recorder for MockMetrics.

func (*MockMetricsMockRecorder) RecordHistogram added in v0.3.0

func (mr *MockMetricsMockRecorder) RecordHistogram(ctx, name, value interface{}, labels ...interface{}) *gomock.Call

RecordHistogram indicates an expected call of RecordHistogram.

type QueryLog

type QueryLog struct {
	Query    string      `json:"query"`
	Duration int64       `json:"duration"`
	Args     interface{} `json:"args,omitempty"`
}

QueryLog represents a logged Redis query.

func (*QueryLog) PrettyPrint added in v1.4.0

func (ql *QueryLog) PrettyPrint(writer io.Writer)

func (*QueryLog) String added in v0.2.0

func (ql *QueryLog) String() string

type Redis

type Redis struct {
	*redis.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c config.Config, logger datasource.Logger, metrics Metrics) *Redis

NewClient return a redis client if connection is successful based on Config. In case of error, it returns an error as second parameter.

func (*Redis) HealthCheck

func (r *Redis) HealthCheck() datasource.Health

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL