migration

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package migration is a generated GoMock package.

Index

Constants

View Source
const (
	CheckAndCreateChMigrationTable = `` /* 266-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func Run

func Run(migrationsMap map[int64]Migrate, c *infra.Container)

Types

type ArangoDB

type ArangoDB interface {
	// CreateDB creates a new database in ArangoDB.
	CreateDB(ctx context.Context, database string) error
	// DropDB deletes an existing database in ArangoDB.
	DropDB(ctx context.Context, database string) error

	// CreateCollection creates a new collection in a database with specified type.
	CreateCollection(ctx context.Context, database, collection string, isEdge bool) error
	// DropCollection deletes an existing collection from a database.
	DropCollection(ctx context.Context, database, collection string) error

	// CreateGraph creates a new graph in a database.
	CreateGraph(ctx context.Context, database, graph string, edgeDefinitions any) error
	// DropGraph deletes an existing graph from a database.
	DropGraph(ctx context.Context, database, graph string) error
}

ArangoDB is an interface representing an ArangoDB database client with common CRUD operations.

type Cassandra

type Cassandra interface {
	Exec(query string, args ...any) error
	NewBatch(name string, batchType int) error
	BatchQuery(name, stmt string, values ...any) error
	ExecuteBatch(name string) error

	HealthCheck(ctx context.Context) (any, error)
}

type Clickhouse

type Clickhouse interface {
	Exec(ctx context.Context, query string, args ...any) error
	Select(ctx context.Context, dest any, query string, args ...any) error
	AsyncInsert(ctx context.Context, query string, wait bool, args ...any) error

	HealthCheck(ctx context.Context) (any, error)
}

type DGraph

type DGraph interface {
	// ApplySchema applies or updates the complete database schema.
	// Parameters:
	// - ctx: Context for request cancellation and timeouts
	// - schema: Schema definition in Dgraph Schema Definition Language (SDL) format
	// Returns:
	// - error: An error if the schema application fails
	ApplySchema(ctx context.Context, schema string) error

	// AddOrUpdateField atomically creates or updates a single field definition.
	// Parameters:
	// - ctx: Context for request cancellation and timeouts
	// - fieldName: Name of the field/predicate to create or update
	// - fieldType: Dgraph data type (e.g., string, int, datetime)
	// - directives: Space-separated Dgraph directives (e.g., "@index(hash) @upsert")
	// Returns:
	// - error: An error if the field operation fails
	AddOrUpdateField(ctx context.Context, fieldName, fieldType, directives string) error

	// DropField permanently removes a field/predicate and all its associated data.
	// Parameters:
	// - ctx: Context for request cancellation and timeouts
	// - fieldName: Name of the field/predicate to remove
	// Returns:
	// - error: An error if the field removal fails
	DropField(ctx context.Context, fieldName string) error
}

type DataPoint

type DataPoint struct {
	Metric    string            `json:"metric"`
	Value     interface{}       `json:"value"`
	Timestamp int64             `json:"timestamp"`
	Tags      map[string]string `json:"tags"`
}

DataPoint represents a time series data point (helper struct for OpenTSDB operations)

type Datasource

type Datasource struct {
	// TODO Logger should not be embedded rather it should be a field.
	// Need to think it through as it will bring breaking changes.
	Logger

	SQL           SQL
	Redis         Redis
	PubSub        PubSub
	Clickhouse    Clickhouse
	Oracle        Oracle
	Cassandra     Cassandra
	Mongo         Mongo
	ArangoDB      ArangoDB
	SurrealDB     SurrealDB
	DGraph        DGraph
	ScyllaDB      ScyllaDB
	Elasticsearch Elasticsearch
	OpenTSDB      OpenTSDB
}

type Elasticsearch

type Elasticsearch interface {
	// CreateIndex creates a new index with optional mapping/settings.
	CreateIndex(ctx context.Context, index string, settings map[string]any) error

	// DeleteIndex deletes an existing index.
	DeleteIndex(ctx context.Context, index string) error

	// IndexDocument indexes (creates or replaces) a single document.
	// Useful for seeding data or adding configuration documents during migrations.
	IndexDocument(ctx context.Context, index, id string, document any) error

	// DeleteDocument removes a document by ID.
	// Useful for removing specific documents during migrations.
	DeleteDocument(ctx context.Context, index, id string) error

	// Bulk executes multiple indexing/updating/deleting operations in one request.
	// Each entry in `operations` should be a JSON‑serializable object
	// following the Elasticsearch bulk API format.
	// Useful for bulk operations during migrations.
	Bulk(ctx context.Context, operations []map[string]any) (map[string]any, error)
}

Elasticsearch is an interface representing an Elasticsearch client for migration operations. It includes only the essential methods needed for schema changes and migrations.

type Logger

type Logger interface {
	Debug(args ...any)
	Debugf(format string, args ...any)
	Info(args ...any)
	Infof(format string, args ...any)
	Notice(args ...any)
	Noticef(format string, args ...any)
	Warn(args ...any)
	Warnf(format string, args ...any)
	Error(args ...any)
	Errorf(format string, args ...any)
	Fatal(args ...any)
	Fatalf(format string, args ...any)
}

type Migrate

type Migrate struct {
	UP MigrateFunc
}

type MigrateFunc

type MigrateFunc func(d Datasource) error

type MockArangoDB

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

MockArangoDB is a mock of ArangoDB interface.

func NewMockArangoDB

func NewMockArangoDB(ctrl *gomock.Controller) *MockArangoDB

NewMockArangoDB creates a new mock instance.

func (*MockArangoDB) CreateCollection

func (m *MockArangoDB) CreateCollection(ctx context.Context, database, collection string, isEdge bool) error

CreateCollection mocks base method.

func (*MockArangoDB) CreateDB

func (m *MockArangoDB) CreateDB(ctx context.Context, database string) error

CreateDB mocks base method.

func (*MockArangoDB) CreateGraph

func (m *MockArangoDB) CreateGraph(ctx context.Context, database, graph string, edgeDefinitions any) error

CreateGraph mocks base method.

func (*MockArangoDB) DropCollection

func (m *MockArangoDB) DropCollection(ctx context.Context, database, collection string) error

DropCollection mocks base method.

func (*MockArangoDB) DropDB

func (m *MockArangoDB) DropDB(ctx context.Context, database string) error

DropDB mocks base method.

func (*MockArangoDB) DropGraph

func (m *MockArangoDB) DropGraph(ctx context.Context, database, graph string) error

DropGraph mocks base method.

func (*MockArangoDB) EXPECT

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

type MockArangoDBMockRecorder

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

MockArangoDBMockRecorder is the mock recorder for MockArangoDB.

func (*MockArangoDBMockRecorder) CreateCollection

func (mr *MockArangoDBMockRecorder) CreateCollection(ctx, database, collection, isEdge any) *gomock.Call

CreateCollection indicates an expected call of CreateCollection.

func (*MockArangoDBMockRecorder) CreateDB

func (mr *MockArangoDBMockRecorder) CreateDB(ctx, database any) *gomock.Call

CreateDB indicates an expected call of CreateDB.

func (*MockArangoDBMockRecorder) CreateGraph

func (mr *MockArangoDBMockRecorder) CreateGraph(ctx, database, graph, edgeDefinitions any) *gomock.Call

CreateGraph indicates an expected call of CreateGraph.

func (*MockArangoDBMockRecorder) DropCollection

func (mr *MockArangoDBMockRecorder) DropCollection(ctx, database, collection any) *gomock.Call

DropCollection indicates an expected call of DropCollection.

func (*MockArangoDBMockRecorder) DropDB

func (mr *MockArangoDBMockRecorder) DropDB(ctx, database any) *gomock.Call

DropDB indicates an expected call of DropDB.

func (*MockArangoDBMockRecorder) DropGraph

func (mr *MockArangoDBMockRecorder) DropGraph(ctx, database, graph any) *gomock.Call

DropGraph indicates an expected call of DropGraph.

type MockCassandra

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

MockCassandra is a mock of Cassandra interface.

func NewMockCassandra

func NewMockCassandra(ctrl *gomock.Controller) *MockCassandra

NewMockCassandra creates a new mock instance.

func (*MockCassandra) BatchQuery

func (m *MockCassandra) BatchQuery(name, stmt string, values ...any) error

BatchQuery mocks base method.

func (*MockCassandra) EXPECT

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

func (*MockCassandra) Exec

func (m *MockCassandra) Exec(query string, args ...any) error

Exec mocks base method.

func (*MockCassandra) ExecuteBatch

func (m *MockCassandra) ExecuteBatch(name string) error

ExecuteBatch mocks base method.

func (*MockCassandra) HealthCheck

func (m *MockCassandra) HealthCheck(ctx context.Context) (any, error)

HealthCheck mocks base method.

func (*MockCassandra) NewBatch

func (m *MockCassandra) NewBatch(name string, batchType int) error

NewBatch mocks base method.

type MockCassandraMockRecorder

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

MockCassandraMockRecorder is the mock recorder for MockCassandra.

func (*MockCassandraMockRecorder) BatchQuery

func (mr *MockCassandraMockRecorder) BatchQuery(name, stmt any, values ...any) *gomock.Call

BatchQuery indicates an expected call of BatchQuery.

func (*MockCassandraMockRecorder) Exec

func (mr *MockCassandraMockRecorder) Exec(query any, args ...any) *gomock.Call

Exec indicates an expected call of Exec.

func (*MockCassandraMockRecorder) ExecuteBatch

func (mr *MockCassandraMockRecorder) ExecuteBatch(name any) *gomock.Call

ExecuteBatch indicates an expected call of ExecuteBatch.

func (*MockCassandraMockRecorder) HealthCheck

func (mr *MockCassandraMockRecorder) HealthCheck(ctx any) *gomock.Call

HealthCheck indicates an expected call of HealthCheck.

func (*MockCassandraMockRecorder) NewBatch

func (mr *MockCassandraMockRecorder) NewBatch(name, batchType any) *gomock.Call

NewBatch indicates an expected call of NewBatch.

type MockClickhouse

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

MockClickhouse is a mock of Clickhouse interface.

func NewMockClickhouse

func NewMockClickhouse(ctrl *gomock.Controller) *MockClickhouse

NewMockClickhouse creates a new mock instance.

func (*MockClickhouse) AsyncInsert

func (m *MockClickhouse) AsyncInsert(ctx context.Context, query string, wait bool, args ...any) error

AsyncInsert mocks base method.

func (*MockClickhouse) EXPECT

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

func (*MockClickhouse) Exec

func (m *MockClickhouse) Exec(ctx context.Context, query string, args ...any) error

Exec mocks base method.

func (*MockClickhouse) HealthCheck

func (m *MockClickhouse) HealthCheck(ctx context.Context) (any, error)

HealthCheck mocks base method.

func (*MockClickhouse) Select

func (m *MockClickhouse) Select(ctx context.Context, dest any, query string, args ...any) error

Select mocks base method.

type MockClickhouseMockRecorder

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

MockClickhouseMockRecorder is the mock recorder for MockClickhouse.

func (*MockClickhouseMockRecorder) AsyncInsert

func (mr *MockClickhouseMockRecorder) AsyncInsert(ctx, query, wait any, args ...any) *gomock.Call

AsyncInsert indicates an expected call of AsyncInsert.

func (*MockClickhouseMockRecorder) Exec

func (mr *MockClickhouseMockRecorder) Exec(ctx, query any, args ...any) *gomock.Call

Exec indicates an expected call of Exec.

func (*MockClickhouseMockRecorder) HealthCheck

func (mr *MockClickhouseMockRecorder) HealthCheck(ctx any) *gomock.Call

HealthCheck indicates an expected call of HealthCheck.

func (*MockClickhouseMockRecorder) Select

func (mr *MockClickhouseMockRecorder) Select(ctx, dest, query any, args ...any) *gomock.Call

Select indicates an expected call of Select.

type MockDGraph

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

MockDGraph is a mock of DGraph interface.

func NewMockDGraph

func NewMockDGraph(ctrl *gomock.Controller) *MockDGraph

NewMockDGraph creates a new mock instance.

func (*MockDGraph) AddOrUpdateField

func (m *MockDGraph) AddOrUpdateField(ctx context.Context, fieldName, fieldType, directives string) error

AddOrUpdateField mocks base method.

func (*MockDGraph) ApplySchema

func (m *MockDGraph) ApplySchema(ctx context.Context, schema string) error

ApplySchema mocks base method.

func (*MockDGraph) DropField

func (m *MockDGraph) DropField(ctx context.Context, fieldName string) error

DropField mocks base method.

func (*MockDGraph) EXPECT

func (m *MockDGraph) EXPECT() *MockDGraphMockRecorder

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

type MockDGraphMockRecorder

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

MockDGraphMockRecorder is the mock recorder for MockDGraph.

func (*MockDGraphMockRecorder) AddOrUpdateField

func (mr *MockDGraphMockRecorder) AddOrUpdateField(ctx, fieldName, fieldType, directives any) *gomock.Call

AddOrUpdateField indicates an expected call of AddOrUpdateField.

func (*MockDGraphMockRecorder) ApplySchema

func (mr *MockDGraphMockRecorder) ApplySchema(ctx, schema any) *gomock.Call

ApplySchema indicates an expected call of ApplySchema.

func (*MockDGraphMockRecorder) DropField

func (mr *MockDGraphMockRecorder) DropField(ctx, fieldName any) *gomock.Call

DropField indicates an expected call of DropField.

type MockElasticsearch

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

MockElasticsearch is a mock of Elasticsearch interface.

func NewMockElasticsearch

func NewMockElasticsearch(ctrl *gomock.Controller) *MockElasticsearch

NewMockElasticsearch creates a new mock instance.

func (*MockElasticsearch) Bulk

func (m *MockElasticsearch) Bulk(ctx context.Context, operations []map[string]any) (map[string]any, error)

Bulk mocks base method.

func (*MockElasticsearch) CreateIndex

func (m *MockElasticsearch) CreateIndex(ctx context.Context, index string, settings map[string]any) error

CreateIndex mocks base method.

func (*MockElasticsearch) DeleteDocument

func (m *MockElasticsearch) DeleteDocument(ctx context.Context, index, id string) error

DeleteDocument mocks base method.

func (*MockElasticsearch) DeleteIndex

func (m *MockElasticsearch) DeleteIndex(ctx context.Context, index string) error

DeleteIndex mocks base method.

func (*MockElasticsearch) EXPECT

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

func (*MockElasticsearch) GetDocument

func (m *MockElasticsearch) GetDocument(ctx context.Context, index, id string) (map[string]any, error)

GetDocument mocks base method.

func (*MockElasticsearch) HealthCheck

func (m *MockElasticsearch) HealthCheck(ctx context.Context) (any, error)

HealthCheck mocks base method.

func (*MockElasticsearch) IndexDocument

func (m *MockElasticsearch) IndexDocument(ctx context.Context, index, id string, document any) error

IndexDocument mocks base method.

func (*MockElasticsearch) Search

func (m *MockElasticsearch) Search(ctx context.Context, indices []string, query map[string]any) (map[string]any, error)

Search mocks base method.

func (*MockElasticsearch) UpdateDocument

func (m *MockElasticsearch) UpdateDocument(ctx context.Context, index, id string, update map[string]any) error

UpdateDocument mocks base method.

type MockElasticsearchMockRecorder

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

MockElasticsearchMockRecorder is the mock recorder for MockElasticsearch.

func (*MockElasticsearchMockRecorder) Bulk

func (mr *MockElasticsearchMockRecorder) Bulk(ctx, operations any) *gomock.Call

Bulk indicates an expected call of Bulk.

func (*MockElasticsearchMockRecorder) CreateIndex

func (mr *MockElasticsearchMockRecorder) CreateIndex(ctx, index, settings any) *gomock.Call

CreateIndex indicates an expected call of CreateIndex.

func (*MockElasticsearchMockRecorder) DeleteDocument

func (mr *MockElasticsearchMockRecorder) DeleteDocument(ctx, index, id any) *gomock.Call

DeleteDocument indicates an expected call of DeleteDocument.

func (*MockElasticsearchMockRecorder) DeleteIndex

func (mr *MockElasticsearchMockRecorder) DeleteIndex(ctx, index any) *gomock.Call

DeleteIndex indicates an expected call of DeleteIndex.

func (*MockElasticsearchMockRecorder) GetDocument

func (mr *MockElasticsearchMockRecorder) GetDocument(ctx, index, id any) *gomock.Call

GetDocument indicates an expected call of GetDocument.

func (*MockElasticsearchMockRecorder) HealthCheck

func (mr *MockElasticsearchMockRecorder) HealthCheck(ctx any) *gomock.Call

HealthCheck indicates an expected call of HealthCheck.

func (*MockElasticsearchMockRecorder) IndexDocument

func (mr *MockElasticsearchMockRecorder) IndexDocument(ctx, index, id, document any) *gomock.Call

IndexDocument indicates an expected call of IndexDocument.

func (*MockElasticsearchMockRecorder) Search

func (mr *MockElasticsearchMockRecorder) Search(ctx, indices, query any) *gomock.Call

Search indicates an expected call of Search.

func (*MockElasticsearchMockRecorder) UpdateDocument

func (mr *MockElasticsearchMockRecorder) UpdateDocument(ctx, index, id, update any) *gomock.Call

UpdateDocument indicates an expected call of UpdateDocument.

type MockMongo

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

MockMongo is a mock of Mongo interface.

func NewMockMongo

func NewMockMongo(ctrl *gomock.Controller) *MockMongo

NewMockMongo creates a new mock instance.

func (*MockMongo) CreateCollection

func (m *MockMongo) CreateCollection(ctx context.Context, name string) error

CreateCollection mocks base method.

func (*MockMongo) DeleteMany

func (m *MockMongo) DeleteMany(ctx context.Context, collection string, filter any) (int64, error)

DeleteMany mocks base method.

func (*MockMongo) DeleteOne

func (m *MockMongo) DeleteOne(ctx context.Context, collection string, filter any) (int64, error)

DeleteOne mocks base method.

func (*MockMongo) Drop

func (m *MockMongo) Drop(ctx context.Context, collection string) error

Drop mocks base method.

func (*MockMongo) EXPECT

func (m *MockMongo) EXPECT() *MockMongoMockRecorder

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

func (*MockMongo) Find

func (m *MockMongo) Find(ctx context.Context, collection string, filter, results any) error

Find mocks base method.

func (*MockMongo) FindOne

func (m *MockMongo) FindOne(ctx context.Context, collection string, filter, result any) error

FindOne mocks base method.

func (*MockMongo) InsertMany

func (m *MockMongo) InsertMany(ctx context.Context, collection string, documents []any) ([]any, error)

InsertMany mocks base method.

func (*MockMongo) InsertOne

func (m *MockMongo) InsertOne(ctx context.Context, collection string, document any) (any, error)

InsertOne mocks base method.

func (*MockMongo) StartSession

func (m *MockMongo) StartSession() (any, error)

StartSession mocks base method.

func (*MockMongo) UpdateByID

func (m *MockMongo) UpdateByID(ctx context.Context, collection string, id, update any) (int64, error)

UpdateByID mocks base method.

func (*MockMongo) UpdateMany

func (m *MockMongo) UpdateMany(ctx context.Context, collection string, filter, update any) (int64, error)

UpdateMany mocks base method.

func (*MockMongo) UpdateOne

func (m *MockMongo) UpdateOne(ctx context.Context, collection string, filter, update any) error

UpdateOne mocks base method.

type MockMongoMockRecorder

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

MockMongoMockRecorder is the mock recorder for MockMongo.

func (*MockMongoMockRecorder) CreateCollection

func (mr *MockMongoMockRecorder) CreateCollection(ctx, name any) *gomock.Call

CreateCollection indicates an expected call of CreateCollection.

func (*MockMongoMockRecorder) DeleteMany

func (mr *MockMongoMockRecorder) DeleteMany(ctx, collection, filter any) *gomock.Call

DeleteMany indicates an expected call of DeleteMany.

func (*MockMongoMockRecorder) DeleteOne

func (mr *MockMongoMockRecorder) DeleteOne(ctx, collection, filter any) *gomock.Call

DeleteOne indicates an expected call of DeleteOne.

func (*MockMongoMockRecorder) Drop

func (mr *MockMongoMockRecorder) Drop(ctx, collection any) *gomock.Call

Drop indicates an expected call of Drop.

func (*MockMongoMockRecorder) Find

func (mr *MockMongoMockRecorder) Find(ctx, collection, filter, results any) *gomock.Call

Find indicates an expected call of Find.

func (*MockMongoMockRecorder) FindOne

func (mr *MockMongoMockRecorder) FindOne(ctx, collection, filter, result any) *gomock.Call

FindOne indicates an expected call of FindOne.

func (*MockMongoMockRecorder) InsertMany

func (mr *MockMongoMockRecorder) InsertMany(ctx, collection, documents any) *gomock.Call

InsertMany indicates an expected call of InsertMany.

func (*MockMongoMockRecorder) InsertOne

func (mr *MockMongoMockRecorder) InsertOne(ctx, collection, document any) *gomock.Call

InsertOne indicates an expected call of InsertOne.

func (*MockMongoMockRecorder) StartSession

func (mr *MockMongoMockRecorder) StartSession() *gomock.Call

StartSession indicates an expected call of StartSession.

func (*MockMongoMockRecorder) UpdateByID

func (mr *MockMongoMockRecorder) UpdateByID(ctx, collection, id, update any) *gomock.Call

UpdateByID indicates an expected call of UpdateByID.

func (*MockMongoMockRecorder) UpdateMany

func (mr *MockMongoMockRecorder) UpdateMany(ctx, collection, filter, update any) *gomock.Call

UpdateMany indicates an expected call of UpdateMany.

func (*MockMongoMockRecorder) UpdateOne

func (mr *MockMongoMockRecorder) UpdateOne(ctx, collection, filter, update any) *gomock.Call

UpdateOne indicates an expected call of UpdateOne.

type MockOpenTSDB

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

mockopentsdb is a mock of migrator interface for opentsdb.

func NewMockOpenTSDB

func NewMockOpenTSDB(ctrl *gomock.Controller) *MockOpenTSDB

NewMockOpenTSDB creates a new mock instance.

func (*MockOpenTSDB) Connect

func (m *MockOpenTSDB) Connect(ctx context.Context) error

Connect mocks base method.

func (*MockOpenTSDB) CreateDatabase

func (m *MockOpenTSDB) CreateDatabase(ctx context.Context, name string) error

CreateDatabase mocks base method.

func (*MockOpenTSDB) CreateMetric

func (m *MockOpenTSDB) CreateMetric(ctx context.Context, metric string) error

CreateMetric mocks base method.

func (*MockOpenTSDB) Delete

func (m *MockOpenTSDB) Delete(ctx context.Context, metric string, tags map[string]string) error

Delete mocks base method.

func (*MockOpenTSDB) DropDatabase

func (m *MockOpenTSDB) DropDatabase(ctx context.Context, name string) error

DropDatabase mocks base method.

func (*MockOpenTSDB) DropMetric

func (m *MockOpenTSDB) DropMetric(ctx context.Context, metric string) error

DropMetric mocks base method.

func (*MockOpenTSDB) EXPECT

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

func (*MockOpenTSDB) ExecuteQuery

func (m *MockOpenTSDB) ExecuteQuery(ctx context.Context, query string) ([]map[string]interface{}, error)

ExecuteQuery mocks base method.

func (*MockOpenTSDB) GetMetrics

func (m *MockOpenTSDB) GetMetrics(ctx context.Context) ([]string, error)

GetMetrics mocks base method.

func (*MockOpenTSDB) Insert

func (m *MockOpenTSDB) Insert(ctx context.Context, metric string, value interface{}, timestamp int64, tags map[string]string) error

Insert mocks base method.

func (*MockOpenTSDB) InsertBatch

func (m *MockOpenTSDB) InsertBatch(ctx context.Context, dataPoints []DataPoint) error

InsertBatch mocks base method.

func (*MockOpenTSDB) Query

func (m *MockOpenTSDB) Query(ctx context.Context, metric string, tags map[string]string, start, end int64) ([]DataPoint, error)

Query mocks base method.

func (*MockOpenTSDB) QueryRange

func (m *MockOpenTSDB) QueryRange(ctx context.Context, query string, start, end int64) ([]map[string]interface{}, error)

QueryRange mocks base method.

func (*MockOpenTSDB) UpdateTags

func (m *MockOpenTSDB) UpdateTags(ctx context.Context, metric string, oldTags, newTags map[string]string) error

UpdateTags mocks base method.

type MockOpenTSDBMockRecorder

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

MockOpenTSDBMockRecorder is the mock recorder for MockOpenTSDB.

func (*MockOpenTSDBMockRecorder) Connect

func (mr *MockOpenTSDBMockRecorder) Connect(ctx any) *gomock.Call

Connect indicates an expected call of Connect.

func (*MockOpenTSDBMockRecorder) CreateDatabase

func (mr *MockOpenTSDBMockRecorder) CreateDatabase(ctx, name any) *gomock.Call

CreateDatabase indicates an expected call of CreateDatabase.

func (*MockOpenTSDBMockRecorder) CreateMetric

func (mr *MockOpenTSDBMockRecorder) CreateMetric(ctx, metric any) *gomock.Call

CreateMetric indicates an expected call of CreateMetric.

func (*MockOpenTSDBMockRecorder) Delete

func (mr *MockOpenTSDBMockRecorder) Delete(ctx, metric, tags any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockOpenTSDBMockRecorder) DropDatabase

func (mr *MockOpenTSDBMockRecorder) DropDatabase(ctx, name any) *gomock.Call

DropDatabase indicates an expected call of DropDatabase.

func (*MockOpenTSDBMockRecorder) DropMetric

func (mr *MockOpenTSDBMockRecorder) DropMetric(ctx, metric any) *gomock.Call

DropMetric indicates an expected call of DropMetric.

func (*MockOpenTSDBMockRecorder) ExecuteQuery

func (mr *MockOpenTSDBMockRecorder) ExecuteQuery(ctx, query any) *gomock.Call

ExecuteQuery indicates an expected call of ExecuteQuery.

func (*MockOpenTSDBMockRecorder) GetMetrics

func (mr *MockOpenTSDBMockRecorder) GetMetrics(ctx any) *gomock.Call

GetMetrics indicates an expected call of GetMetrics.

func (*MockOpenTSDBMockRecorder) Insert

func (mr *MockOpenTSDBMockRecorder) Insert(ctx, metric, value, timestamp, tags any) *gomock.Call

Insert indicates an expected call of Insert.

func (*MockOpenTSDBMockRecorder) InsertBatch

func (mr *MockOpenTSDBMockRecorder) InsertBatch(ctx, dataPoints any) *gomock.Call

InsertBatch indicates an expected call of InsertBatch.

func (*MockOpenTSDBMockRecorder) Query

func (mr *MockOpenTSDBMockRecorder) Query(ctx, metric, tags, start, end any) *gomock.Call

Query indicates an expected call of Query.

func (*MockOpenTSDBMockRecorder) QueryRange

func (mr *MockOpenTSDBMockRecorder) QueryRange(ctx, query, start, end any) *gomock.Call

QueryRange indicates an expected call of QueryRange.

func (*MockOpenTSDBMockRecorder) UpdateTags

func (mr *MockOpenTSDBMockRecorder) UpdateTags(ctx, metric, oldTags, newTags any) *gomock.Call

UpdateTags indicates an expected call of UpdateTags.

type MockOracle

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

MockOracle is a mock of Oracle interface.

func NewMockOracle

func NewMockOracle(ctrl *gomock.Controller) *MockOracle

NewMockOracle creates a new mock instance.

func (*MockOracle) EXPECT

func (m *MockOracle) EXPECT() *MockOracleMockRecorder

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

func (*MockOracle) Exec

func (m *MockOracle) Exec(ctx context.Context, query string, args ...any) error

Exec mocks base method.

func (*MockOracle) Select

func (m *MockOracle) Select(ctx context.Context, dest any, query string, args ...any) error

Select mocks base method.

type MockOracleMockRecorder

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

MockOracleMockRecorder is the mock recorder for MockOracle.

func (*MockOracleMockRecorder) Exec

func (mr *MockOracleMockRecorder) Exec(ctx, query any, args ...any) *gomock.Call

Exec indicates an expected call of Exec.

func (*MockOracleMockRecorder) Select

func (mr *MockOracleMockRecorder) Select(ctx, dest, query any, args ...any) *gomock.Call

Select indicates an expected call of Select.

type MockPubSub

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

MockPubSub is a mock of PubSub interface.

func NewMockPubSub

func NewMockPubSub(ctrl *gomock.Controller) *MockPubSub

NewMockPubSub creates a new mock instance.

func (*MockPubSub) CreateTopic

func (m *MockPubSub) CreateTopic(arg0 context.Context, name string) error

CreateTopic mocks base method.

func (*MockPubSub) DeleteTopic

func (m *MockPubSub) DeleteTopic(arg0 context.Context, name string) error

DeleteTopic mocks base method.

func (*MockPubSub) EXPECT

func (m *MockPubSub) EXPECT() *MockPubSubMockRecorder

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

func (*MockPubSub) Query

func (m *MockPubSub) Query(ctx context.Context, query string, args ...any) ([]byte, error)

Query mocks base method.

type MockPubSubMockRecorder

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

MockPubSubMockRecorder is the mock recorder for MockPubSub.

func (*MockPubSubMockRecorder) CreateTopic

func (mr *MockPubSubMockRecorder) CreateTopic(arg0, name any) *gomock.Call

CreateTopic indicates an expected call of CreateTopic.

func (*MockPubSubMockRecorder) DeleteTopic

func (mr *MockPubSubMockRecorder) DeleteTopic(arg0, name any) *gomock.Call

DeleteTopic indicates an expected call of DeleteTopic.

func (*MockPubSubMockRecorder) Query

func (mr *MockPubSubMockRecorder) Query(ctx, query any, args ...any) *gomock.Call

Query indicates an expected call of Query.

type MockRedis

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

MockRedis is a mock of Redis interface.

func NewMockRedis

func NewMockRedis(ctrl *gomock.Controller) *MockRedis

NewMockRedis creates a new mock instance.

func (*MockRedis) Del

func (m *MockRedis) Del(ctx context.Context, keys ...string) *redis.IntCmd

Del mocks base method.

func (*MockRedis) EXPECT

func (m *MockRedis) EXPECT() *MockRedisMockRecorder

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

func (*MockRedis) Get

func (m *MockRedis) Get(ctx context.Context, key string) *redis.StringCmd

Get mocks base method.

func (*MockRedis) Rename

func (m *MockRedis) Rename(ctx context.Context, key, newKey string) *redis.StatusCmd

Rename mocks base method.

func (*MockRedis) Set

func (m *MockRedis) Set(ctx context.Context, key string, value any, expiration time.Duration) *redis.StatusCmd

Set mocks base method.

type MockRedisMockRecorder

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

MockRedisMockRecorder is the mock recorder for MockRedis.

func (*MockRedisMockRecorder) Del

func (mr *MockRedisMockRecorder) Del(ctx any, keys ...any) *gomock.Call

Del indicates an expected call of Del.

func (*MockRedisMockRecorder) Get

func (mr *MockRedisMockRecorder) Get(ctx, key any) *gomock.Call

Get indicates an expected call of Get.

func (*MockRedisMockRecorder) Rename

func (mr *MockRedisMockRecorder) Rename(ctx, key, newKey any) *gomock.Call

Rename indicates an expected call of Rename.

func (*MockRedisMockRecorder) Set

func (mr *MockRedisMockRecorder) Set(ctx, key, value, expiration any) *gomock.Call

Set indicates an expected call of Set.

type MockSQL

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

MockSQL is a mock of SQL interface.

func NewMockSQL

func NewMockSQL(ctrl *gomock.Controller) *MockSQL

NewMockSQL creates a new mock instance.

func (*MockSQL) EXPECT

func (m *MockSQL) EXPECT() *MockSQLMockRecorder

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

func (*MockSQL) Exec

func (m *MockSQL) Exec(query string, args ...any) (sql.Result, error)

Exec mocks base method.

func (*MockSQL) ExecContext

func (m *MockSQL) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

ExecContext mocks base method.

func (*MockSQL) Query

func (m *MockSQL) Query(query string, args ...any) (*sql.Rows, error)

Query mocks base method.

func (*MockSQL) QueryRow

func (m *MockSQL) QueryRow(query string, args ...any) *sql.Row

QueryRow mocks base method.

func (*MockSQL) QueryRowContext

func (m *MockSQL) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

QueryRowContext mocks base method.

type MockSQLMockRecorder

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

MockSQLMockRecorder is the mock recorder for MockSQL.

func (*MockSQLMockRecorder) Exec

func (mr *MockSQLMockRecorder) Exec(query any, args ...any) *gomock.Call

Exec indicates an expected call of Exec.

func (*MockSQLMockRecorder) ExecContext

func (mr *MockSQLMockRecorder) ExecContext(ctx, query any, args ...any) *gomock.Call

ExecContext indicates an expected call of ExecContext.

func (*MockSQLMockRecorder) Query

func (mr *MockSQLMockRecorder) Query(query any, args ...any) *gomock.Call

Query indicates an expected call of Query.

func (*MockSQLMockRecorder) QueryRow

func (mr *MockSQLMockRecorder) QueryRow(query any, args ...any) *gomock.Call

QueryRow indicates an expected call of QueryRow.

func (*MockSQLMockRecorder) QueryRowContext

func (mr *MockSQLMockRecorder) QueryRowContext(ctx, query any, args ...any) *gomock.Call

QueryRowContext indicates an expected call of QueryRowContext.

type MockScyllaDB

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

MockScyllaDB is a mock of ScyllaDB interface.

func NewMockScyllaDB

func NewMockScyllaDB(ctrl *gomock.Controller) *MockScyllaDB

NewMockScyllaDB creates a new mock instance.

func (*MockScyllaDB) BatchQuery

func (m *MockScyllaDB) BatchQuery(name, stmt string, values ...any) error

BatchQuery mocks base method.

func (*MockScyllaDB) BatchQueryWithCtx

func (m *MockScyllaDB) BatchQueryWithCtx(ctx context.Context, name, stmt string, values ...any) error

BatchQueryWithCtx mocks base method.

func (*MockScyllaDB) EXPECT

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

func (*MockScyllaDB) Exec

func (m *MockScyllaDB) Exec(stmt string, values ...any) error

Exec mocks base method.

func (*MockScyllaDB) ExecCAS

func (m *MockScyllaDB) ExecCAS(dest any, stmt string, values ...any) (bool, error)

ExecCAS mocks base method.

func (*MockScyllaDB) ExecWithCtx

func (m *MockScyllaDB) ExecWithCtx(ctx context.Context, stmt string, values ...any) error

ExecWithCtx mocks base method.

func (*MockScyllaDB) ExecuteBatchWithCtx

func (m *MockScyllaDB) ExecuteBatchWithCtx(ctx context.Context, name string) error

ExecuteBatchWithCtx mocks base method.

func (*MockScyllaDB) NewBatch

func (m *MockScyllaDB) NewBatch(name string, batchType int) error

NewBatch mocks base method.

func (*MockScyllaDB) NewBatchWithCtx

func (m *MockScyllaDB) NewBatchWithCtx(ctx context.Context, name string, batchType int) error

NewBatchWithCtx mocks base method.

func (*MockScyllaDB) Query

func (m *MockScyllaDB) Query(dest any, stmt string, values ...any) error

Query mocks base method.

func (*MockScyllaDB) QueryWithCtx

func (m *MockScyllaDB) QueryWithCtx(ctx context.Context, dest any, stmt string, values ...any) error

QueryWithCtx mocks base method.

type MockScyllaDBMockRecorder

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

MockScyllaDBMockRecorder is the mock recorder for MockScyllaDB.

func (*MockScyllaDBMockRecorder) BatchQuery

func (mr *MockScyllaDBMockRecorder) BatchQuery(name, stmt any, values ...any) *gomock.Call

BatchQuery indicates an expected call of BatchQuery.

func (*MockScyllaDBMockRecorder) BatchQueryWithCtx

func (mr *MockScyllaDBMockRecorder) BatchQueryWithCtx(ctx, name, stmt any, values ...any) *gomock.Call

BatchQueryWithCtx indicates an expected call of BatchQueryWithCtx.

func (*MockScyllaDBMockRecorder) Exec

func (mr *MockScyllaDBMockRecorder) Exec(stmt any, values ...any) *gomock.Call

Exec indicates an expected call of Exec.

func (*MockScyllaDBMockRecorder) ExecCAS

func (mr *MockScyllaDBMockRecorder) ExecCAS(dest, stmt any, values ...any) *gomock.Call

ExecCAS indicates an expected call of ExecCAS.

func (*MockScyllaDBMockRecorder) ExecWithCtx

func (mr *MockScyllaDBMockRecorder) ExecWithCtx(ctx, stmt any, values ...any) *gomock.Call

ExecWithCtx indicates an expected call of ExecWithCtx.

func (*MockScyllaDBMockRecorder) ExecuteBatchWithCtx

func (mr *MockScyllaDBMockRecorder) ExecuteBatchWithCtx(ctx, name any) *gomock.Call

ExecuteBatchWithCtx indicates an expected call of ExecuteBatchWithCtx.

func (*MockScyllaDBMockRecorder) NewBatch

func (mr *MockScyllaDBMockRecorder) NewBatch(name, batchType any) *gomock.Call

NewBatch indicates an expected call of NewBatch.

func (*MockScyllaDBMockRecorder) NewBatchWithCtx

func (mr *MockScyllaDBMockRecorder) NewBatchWithCtx(ctx, name, batchType any) *gomock.Call

NewBatchWithCtx indicates an expected call of NewBatchWithCtx.

func (*MockScyllaDBMockRecorder) Query

func (mr *MockScyllaDBMockRecorder) Query(dest, stmt any, values ...any) *gomock.Call

Query indicates an expected call of Query.

func (*MockScyllaDBMockRecorder) QueryWithCtx

func (mr *MockScyllaDBMockRecorder) QueryWithCtx(ctx, dest, stmt any, values ...any) *gomock.Call

QueryWithCtx indicates an expected call of QueryWithCtx.

type MockSurrealDB

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

MockSurrealDB is a mock of SurrealDB interface.

func NewMockSurrealDB

func NewMockSurrealDB(ctrl *gomock.Controller) *MockSurrealDB

NewMockSurrealDB creates a new mock instance.

func (*MockSurrealDB) CreateDatabase

func (m *MockSurrealDB) CreateDatabase(ctx context.Context, database string) error

CreateDatabase mocks base method.

func (*MockSurrealDB) CreateNamespace

func (m *MockSurrealDB) CreateNamespace(ctx context.Context, namespace string) error

CreateNamespace mocks base method.

func (*MockSurrealDB) DropDatabase

func (m *MockSurrealDB) DropDatabase(ctx context.Context, database string) error

DropDatabase mocks base method.

func (*MockSurrealDB) DropNamespace

func (m *MockSurrealDB) DropNamespace(ctx context.Context, namespace string) error

DropNamespace mocks base method.

func (*MockSurrealDB) EXPECT

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

func (*MockSurrealDB) Query

func (m *MockSurrealDB) Query(ctx context.Context, query string, vars map[string]any) ([]any, error)

Query mocks base method.

type MockSurrealDBMockRecorder

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

MockSurrealDBMockRecorder is the mock recorder for MockSurrealDB.

func (*MockSurrealDBMockRecorder) CreateDatabase

func (mr *MockSurrealDBMockRecorder) CreateDatabase(ctx, database any) *gomock.Call

CreateDatabase indicates an expected call of CreateDatabase.

func (*MockSurrealDBMockRecorder) CreateNamespace

func (mr *MockSurrealDBMockRecorder) CreateNamespace(ctx, namespace any) *gomock.Call

CreateNamespace indicates an expected call of CreateNamespace.

func (*MockSurrealDBMockRecorder) DropDatabase

func (mr *MockSurrealDBMockRecorder) DropDatabase(ctx, database any) *gomock.Call

DropDatabase indicates an expected call of DropDatabase.

func (*MockSurrealDBMockRecorder) DropNamespace

func (mr *MockSurrealDBMockRecorder) DropNamespace(ctx, namespace any) *gomock.Call

DropNamespace indicates an expected call of DropNamespace.

func (*MockSurrealDBMockRecorder) Query

func (mr *MockSurrealDBMockRecorder) Query(ctx, query, vars any) *gomock.Call

Query indicates an expected call of Query.

type Mockmigrator

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

Mockmigrator is a mock of migrator interface.

func NewMockmigrator

func NewMockmigrator(ctrl *gomock.Controller) *Mockmigrator

NewMockmigrator creates a new mock instance.

func (*Mockmigrator) EXPECT

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

type MockmigratorMockRecorder

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

MockmigratorMockRecorder is the mock recorder for Mockmigrator.

type Mongo

type Mongo interface {
	Find(ctx context.Context, collection string, filter any, results any) error
	FindOne(ctx context.Context, collection string, filter any, result any) error
	InsertOne(ctx context.Context, collection string, document any) (any, error)
	InsertMany(ctx context.Context, collection string, documents []any) ([]any, error)
	DeleteOne(ctx context.Context, collection string, filter any) (int64, error)
	DeleteMany(ctx context.Context, collection string, filter any) (int64, error)
	UpdateByID(ctx context.Context, collection string, id any, update any) (int64, error)
	UpdateOne(ctx context.Context, collection string, filter any, update any) error
	UpdateMany(ctx context.Context, collection string, filter any, update any) (int64, error)
	Drop(ctx context.Context, collection string) error
	CreateCollection(ctx context.Context, name string) error
	StartSession() (any, error)
}

Mongo is an interface representing a MongoDB database client with common CRUD operations.

type OpenTSDB

type OpenTSDB interface {
	// PutDataPoints can be used for seeding initial metrics during migration
	PutDataPoints(ctx context.Context, data any, queryParam string, res any) error
	// PostAnnotation creates or updates an annotation in OpenTSDB using the 'POST /api/annotation' endpoint.
	PostAnnotation(ctx context.Context, annotation any, res any) error
	// PutAnnotation creates or replaces an annotation in OpenTSDB using the 'PUT /api/annotation' endpoint.
	PutAnnotation(ctx context.Context, annotation any, res any) error
	// DeleteAnnotation removes an annotation from OpenTSDB using the 'DELETE /api/annotation' endpoint.
	DeleteAnnotation(ctx context.Context, annotation any, res any) error
}

type Oracle

type Oracle interface {
	Select(ctx context.Context, dest any, query string, args ...any) error
	Exec(ctx context.Context, query string, args ...any) error
	Begin() (infra.OracleTx, error)
}

type PubSub

type PubSub interface {
	Query(ctx context.Context, query string, args ...any) ([]byte, error)
	CreateTopic(context context.Context, name string) error
	DeleteTopic(context context.Context, name string) error
}

type Redis

type Redis interface {
	Get(ctx context.Context, key string) *goRedis.StringCmd
	Set(ctx context.Context, key string, value any, expiration time.Duration) *goRedis.StatusCmd
	Del(ctx context.Context, keys ...string) *goRedis.IntCmd
	Rename(ctx context.Context, key, newKey string) *goRedis.StatusCmd
}

type SQL

type SQL interface {
	Query(query string, args ...any) (*sql.Rows, error)
	QueryRow(query string, args ...any) *sql.Row
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
	Exec(query string, args ...any) (sql.Result, error)
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

type ScyllaDB

type ScyllaDB interface {
	Query(dest any, stmt string, values ...any) error
	QueryWithCtx(ctx context.Context, dest any, stmt string, values ...any) error

	Exec(stmt string, values ...any) error
	ExecWithCtx(ctx context.Context, stmt string, values ...any) error

	ExecCAS(dest any, stmt string, values ...any) (bool, error)

	NewBatch(name string, batchType int) error
	NewBatchWithCtx(ctx context.Context, name string, batchType int) error

	BatchQuery(name, stmt string, values ...any) error
	BatchQueryWithCtx(ctx context.Context, name, stmt string, values ...any) error

	ExecuteBatchWithCtx(ctx context.Context, name string) error
}

type SurrealDB

type SurrealDB interface {
	// Query executes a Surreal query with the provided variables and returns the query results as a slice of interfaces{}.
	// It returns an error if the query execution fails.
	Query(ctx context.Context, query string, vars map[string]any) ([]any, error)

	// CreateNamespace creates a new namespace in the SurrealDB instance.
	CreateNamespace(ctx context.Context, namespace string) error

	// CreateDatabase creates a new database in the SurrealDB instance.
	CreateDatabase(ctx context.Context, database string) error

	// DropNamespace deletes a namespace from the SurrealDB instance.
	DropNamespace(ctx context.Context, namespace string) error

	// DropDatabase deletes a database from the SurrealDB instance.
	DropDatabase(ctx context.Context, database string) error
}

Jump to

Keyboard shortcuts

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