mongodb

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URI      string
	Database string
	MinPool  uint64
	MaxPool  uint64
}

Config holds the MongoDB configuration.

type MongoDB

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

MongoDB is a mongoDB client.

func NewMongoDB

func NewMongoDB(client *mongo.Database) *MongoDB

NewMongoDB creates a MongoDB.

func (*MongoDB) Bootstrap

func (m *MongoDB) Bootstrap() error

Bootstrap indexes if not present (collection is automatically created).

func (*MongoDB) Create

func (m *MongoDB) Create(ctx context.Context, plugin db.Plugin) (db.Plugin, error)

Create creates a new plugin.

func (*MongoDB) CreateHash

func (m *MongoDB) CreateHash(ctx context.Context, module, version, hash string) (db.PluginHash, error)

CreateHash creates a new plugin hash.

func (*MongoDB) Delete

func (m *MongoDB) Delete(ctx context.Context, id string) error

Delete deletes the plugin corresponding to the given ID.

func (*MongoDB) Get

func (m *MongoDB) Get(ctx context.Context, id string) (db.Plugin, error)

Get returns the plugin corresponding to the given ID.

func (*MongoDB) GetByName

func (m *MongoDB) GetByName(ctx context.Context, name string, filterDisabled, filterHidden bool) (db.Plugin, error)

GetByName gets the plugin with the given name.

func (*MongoDB) GetHashByName

func (m *MongoDB) GetHashByName(ctx context.Context, module, version string) (db.PluginHash, error)

GetHashByName returns the hash corresponding the given name.

func (*MongoDB) List

func (m *MongoDB) List(ctx context.Context, page db.Pagination) ([]db.Plugin, string, error)

List lists plugins.

func (*MongoDB) Ping

func (m *MongoDB) Ping(ctx context.Context) error

Ping pings MongoDB to check it health status.

func (*MongoDB) SearchByName

func (m *MongoDB) SearchByName(ctx context.Context, name string, page db.Pagination) ([]db.Plugin, string, error)

SearchByName searches for plugins matching with the given name.

func (*MongoDB) Update

func (m *MongoDB) Update(ctx context.Context, id string, plugin db.Plugin) (db.Plugin, error)

Update updates the given plugin.

type MongoIndex

type MongoIndex struct {
	Key  bson.D
	Name string
	V    int32
}

MongoIndex represents a MongoDB index.

Jump to

Keyboard shortcuts

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