mongodb

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PluginKey = plugins.PluginInterface + ".porter.mongodb"

Variables

View Source
var (
	ErrNotConnected = errors.New("cannot execute command against the mongodb plugin because the session is closed (or was never connected)")
)

Functions

func NewPlugin

func NewPlugin(c *portercontext.Context, rawCfg interface{}) (plugin.Plugin, error)

Types

type Plugin

type Plugin struct {
	*Store
}

type PluginConfig

type PluginConfig struct {
	URL     string `mapstructure:"url"`
	Timeout int    `mapstructure:"timeout,omitempty"`
}

PluginConfig are the configuration settings that can be defined for the mongodb plugin in porter.yaml

type Store

type Store struct {
	*portercontext.Context
	// contains filtered or unexported fields
}

Store implements the Porter plugin.StoragePlugin interface for mongodb.

func NewStore

func NewStore(c *portercontext.Context, cfg PluginConfig) *Store

NewStore creates a new storage engine that uses MongoDB.

func (*Store) Aggregate

func (s *Store) Aggregate(ctx context.Context, opts plugins.AggregateOptions) ([]bson.Raw, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Connect

func (s *Store) Connect(ctx context.Context) error

Connect initializes the plugin for use. The plugin itself is responsible for ensuring it was called. Close is called automatically when the plugin is used by Porter.

func (*Store) Count

func (s *Store) Count(ctx context.Context, opts plugins.CountOptions) (int64, error)

func (*Store) EnsureIndex

func (s *Store) EnsureIndex(ctx context.Context, opts plugins.EnsureIndexOptions) error

EnsureIndexes makes sure that the specified indexes exist and are defined appropriately.

func (*Store) Find

func (s *Store) Find(ctx context.Context, opts plugins.FindOptions) ([]bson.Raw, error)

func (*Store) Insert

func (s *Store) Insert(ctx context.Context, opts plugins.InsertOptions) error

func (*Store) Patch

func (s *Store) Patch(ctx context.Context, opts plugins.PatchOptions) error

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping the connected session to check if everything is okay.

func (*Store) Remove

func (s *Store) Remove(ctx context.Context, opts plugins.RemoveOptions) error

func (*Store) RemoveDatabase

func (s *Store) RemoveDatabase(ctx context.Context) error

RemoveDatabase removes the current database.

func (*Store) Update

func (s *Store) Update(ctx context.Context, opts plugins.UpdateOptions) error

Jump to

Keyboard shortcuts

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