mongodb

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) DeleteBlacklist added in v1.14.0

func (m *MongoDB) DeleteBlacklist(ctx context.Context, repository string) error

DeleteBlacklist removes the blacklist entry for the given repository.

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) ListBlacklist added in v1.14.0

func (m *MongoDB) ListBlacklist(ctx context.Context) ([]db.BlacklistEntry, error)

ListBlacklist returns all the blacklisted repositories, sorted by repository.

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.

func (*MongoDB) UpdateHashVerified added in v1.13.2

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

UpdateHashVerified updates the verified value for a plugin hash.

func (*MongoDB) UpsertBlacklist added in v1.14.0

func (m *MongoDB) UpsertBlacklist(ctx context.Context, entry db.BlacklistEntry) (db.BlacklistEntry, error)

UpsertBlacklist creates or updates a blacklist entry, keyed by repository. CreatedAt is only set on insert.

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