mongodbclient

package
v1.56.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSearchIndexNotFound = errors.New("search Index not found")

Functions

This section is empty.

Types

type Collection

type Collection interface {
	Aggregate(context.Context, interface{}) (*mongo.Cursor, error)
}

type Database

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

type MongoDBClient

type MongoDBClient interface {
	Connect(connectionString string, waitSeconds int64) error
	Disconnect()
	Database(db string) Database
	SearchIndex(id string) (*admin.ClusterSearchIndex, error)
	DeleteSearchIndex(id string) error
}

func NewClient

func NewClient() MongoDBClient

func NewClientWithContext

func NewClientWithContext(context context.Context) MongoDBClient

type SearchIndex

type SearchIndex interface {
	CreateSearchIndex(ctx context.Context, collection string, idx *admin.ClusterSearchIndex) (*admin.ClusterSearchIndex, error)
	SearchIndex(ctx context.Context, id string) (*admin.ClusterSearchIndex, error)
	SearchIndexes(ctx context.Context, coll string) ([]*admin.ClusterSearchIndex, error)
	SearchIndexByName(ctx context.Context, name string, collection string) (*admin.ClusterSearchIndex, error)
}

type SearchIndexDefinition

type SearchIndexDefinition struct {
	ID         string                                 `bson:"id,omitempty"`
	Name       string                                 `bson:"name,omitempty"`
	Collection string                                 `bson:"collection,omitempty"`
	Database   string                                 `bson:"database,omitempty"`
	Analyzer   *string                                `bson:"analyzer,omitempty"`
	Analyzers  []admin.ApiAtlasFTSAnalyzers           `bson:"analyzers,omitempty"`
	Synonyms   []admin.SearchSynonymMappingDefinition `bson:"synonyms,omitempty"`
	Mappings   *admin.ApiAtlasFTSMappings             `bson:"mappings,omitempty"`
	Status     *string                                `bson:"status,omitempty"`
}

type User

type User interface {
	CreateUser(ctx context.Context, username, password string, roles []string) error
	DropUser(ctx context.Context, username string) error
}

Jump to

Keyboard shortcuts

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