Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions internal/mocks/mock_mongodb_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions internal/mongodbclient/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ package mongodbclient

import (
"context"
"fmt"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
)

type Database interface {
RunCommand(ctx context.Context, runCommand any) (any, error)
InsertOne(ctx context.Context, collection string, doc any) (any, error)
InitiateReplicaSet(ctx context.Context, rsName string, hostname string, internalPort int, externalPort int) error
SearchIndex
User
Collection(string) Collection
}

Expand All @@ -53,24 +49,3 @@ func (d *database) RunCommand(ctx context.Context, runCmd any) (any, error) {
}
return cmdResult, nil
}

func (d *database) InsertOne(ctx context.Context, col string, doc any) (any, error) {
return d.db.Collection(col).InsertOne(ctx, doc)
}

func (d *database) InitiateReplicaSet(ctx context.Context, rsName string, hostname string, internalPort int, externalPort int) error {
return d.db.RunCommand(ctx, bson.D{{Key: "replSetInitiate", Value: bson.M{
"_id": rsName,
"version": 1,
"configsvr": false,
"members": []bson.M{
{
"_id": 0,
"host": fmt.Sprintf("%s:%d", hostname, internalPort),
"horizons": bson.M{
"external": fmt.Sprintf("localhost:%d", externalPort),
},
},
},
}}}).Err()
}
52 changes: 0 additions & 52 deletions internal/mongodbclient/user.go

This file was deleted.