solr

package module
v0.0.0-...-2ab14e3 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package solr is a generated GoMock package.

Package solr is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(conf Config) *Client

New initializes Solr driver with the provided configuration. The Connect method must be called to establish a connection to Solr. Usage: client := New(config) client.UseLogger(loggerInstance) client.UseMetrics(metricsInstance) client.Connect().

func (*Client) AddField

func (c *Client) AddField(ctx context.Context, collection string, document *bytes.Buffer) (any, error)

AddField adds Field in the schema for the specified collection.

func (*Client) Connect

func (c *Client) Connect()

Connect establishes a connection to Solr and registers metrics using the provided configuration when the client was Created.

func (*Client) Create

func (c *Client) Create(ctx context.Context, collection string, document *bytes.Buffer,
	params map[string]any) (any, error)

Create makes documents in the specified collection. params can be used to send parameters like commit=true.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, collection string, document *bytes.Buffer,
	params map[string]any) (any, error)

Delete deletes documents in the specified collection. params can be used to send parameters like commit=true.

func (*Client) DeleteField

func (c *Client) DeleteField(ctx context.Context, collection string, document *bytes.Buffer) (any, error)

DeleteField deletes the field definitions in the schema for the specified collection.

func (*Client) HealthCheck

func (c *Client) HealthCheck(ctx context.Context) (any, error)

func (*Client) ListFields

func (c *Client) ListFields(ctx context.Context, collection string, params map[string]any) (any, error)

ListFields retrieves all the fields in the schema for the specified collection. params can be used to send query parameters like wt, fl, includeDynamic etc.

func (*Client) Retrieve

func (c *Client) Retrieve(ctx context.Context, collection string, params map[string]any) (any, error)

Retrieve retrieves the entire schema that includes all the fields,field types,dynamic rules and copy field rules. params can be used to specify the format of response.

func (*Client) Search

func (c *Client) Search(ctx context.Context, collection string, params map[string]any) (any, error)

Search searches documents in the given collections based on the parameters specified. This can be used for making any queries to Solr.

func (*Client) Update

func (c *Client) Update(ctx context.Context, collection string, document *bytes.Buffer,
	params map[string]any) (any, error)

Update updates documents in the specified collection. params can be used to send parameters like commit=true.

func (*Client) UpdateField

func (c *Client) UpdateField(ctx context.Context, collection string, document *bytes.Buffer) (any, error)

UpdateField updates the field definitions in the schema for the specified collection.

func (*Client) UseLogger

func (c *Client) UseLogger(logger any)

UseLogger sets the logger for the Solr client which asserts the Logger interface.

func (*Client) UseMetrics

func (c *Client) UseMetrics(metrics any)

UseMetrics sets the metrics for the Solr client which asserts the Metrics interface.

func (*Client) UseTracer

func (c *Client) UseTracer(tracer any)

UseTracer sets the tracer for Solr client.

type Config

type Config struct {
	Host string
	Port string
}

type Logger

type Logger interface {
	Debug(args ...any)
	Debugf(pattern string, args ...any)
	Info(args ...any)
	Infof(pattern string, args ...any)
	Error(args ...any)
	Errorf(patter string, args ...any)
}

type Metrics

type Metrics interface {
	NewHistogram(name, desc string, buckets ...float64)

	RecordHistogram(ctx context.Context, name string, value float64, labels ...string)
}

type MockLogger

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

MockLogger is a mock of Logger interface.

func NewMockLogger

func NewMockLogger(ctrl *gomock.Controller) *MockLogger

NewMockLogger creates a new mock instance.

func (*MockLogger) Debug

func (m *MockLogger) Debug(args ...any)

Debug mocks base method.

func (*MockLogger) Debugf

func (m *MockLogger) Debugf(pattern string, args ...any)

Debugf mocks base method.

func (*MockLogger) EXPECT

func (m *MockLogger) EXPECT() *MockLoggerMockRecorder

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

func (*MockLogger) Error

func (m *MockLogger) Error(args ...any)

Error mocks base method.

func (*MockLogger) Errorf

func (m *MockLogger) Errorf(patter string, args ...any)

Errorf mocks base method.

func (*MockLogger) Info

func (m *MockLogger) Info(args ...any)

Info mocks base method.

func (*MockLogger) Infof

func (m *MockLogger) Infof(pattern string, args ...any)

Infof mocks base method.

type MockLoggerMockRecorder

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

MockLoggerMockRecorder is the mock recorder for MockLogger.

func (*MockLoggerMockRecorder) Debug

func (mr *MockLoggerMockRecorder) Debug(args ...any) *gomock.Call

Debug indicates an expected call of Debug.

func (*MockLoggerMockRecorder) Debugf

func (mr *MockLoggerMockRecorder) Debugf(pattern any, args ...any) *gomock.Call

Debugf indicates an expected call of Debugf.

func (*MockLoggerMockRecorder) Error

func (mr *MockLoggerMockRecorder) Error(args ...any) *gomock.Call

Error indicates an expected call of Error.

func (*MockLoggerMockRecorder) Errorf

func (mr *MockLoggerMockRecorder) Errorf(patter any, args ...any) *gomock.Call

Errorf indicates an expected call of Errorf.

func (*MockLoggerMockRecorder) Info

func (mr *MockLoggerMockRecorder) Info(args ...any) *gomock.Call

Info indicates an expected call of Info.

func (*MockLoggerMockRecorder) Infof

func (mr *MockLoggerMockRecorder) Infof(pattern any, args ...any) *gomock.Call

Infof indicates an expected call of Infof.

type MockMetrics

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

MockMetrics is a mock of Metrics interface.

func NewMockMetrics

func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics

NewMockMetrics creates a new mock instance.

func (*MockMetrics) EXPECT

func (m *MockMetrics) EXPECT() *MockMetricsMockRecorder

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

func (*MockMetrics) NewHistogram

func (m *MockMetrics) NewHistogram(name, desc string, buckets ...float64)

NewHistogram mocks base method.

func (*MockMetrics) RecordHistogram

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

RecordHistogram mocks base method.

type MockMetricsMockRecorder

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

MockMetricsMockRecorder is the mock recorder for MockMetrics.

func (*MockMetricsMockRecorder) NewHistogram

func (mr *MockMetricsMockRecorder) NewHistogram(name, desc any, buckets ...any) *gomock.Call

NewHistogram indicates an expected call of NewHistogram.

func (*MockMetricsMockRecorder) RecordHistogram

func (mr *MockMetricsMockRecorder) RecordHistogram(ctx, name, value any, labels ...any) *gomock.Call

RecordHistogram indicates an expected call of RecordHistogram.

type QueryLog

type QueryLog struct {
	Type     string `json:"type"`
	URL      string `json:"Url"`
	Duration int64  `json:"duration"`
}

func (*QueryLog) PrettyPrint

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

type Response

type Response struct {
	Code int
	Data any
}

Response stores the response from Solr.

Jump to

Keyboard shortcuts

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