driver

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	// NewSpecStore returns a store for managing specifications.
	NewSpecStore(ctx context.Context, name string) (spec.Store, error)

	// NewValueStore returns a store for managing values.
	NewValueStore(ctx context.Context, name string) (value.Store, error)

	// Close terminates the connection and releases resources.
	Close(ctx context.Context) error
}

Driver defines an interface for interacting with various storage mechanisms.

func NewInMemoryDriver

func NewInMemoryDriver() Driver

NewInMemoryDriver creates and returns a new InMemoryDriver instance.

func NewMongoDriver

func NewMongoDriver(uri, name string) (Driver, error)

NewMongoDriver initializes a new MongoDB connection and returns a Driver instance.

type InMemoryDriver

type InMemoryDriver struct{}

InMemoryDriver is a mock driver that provides in-memory stores.

func (*InMemoryDriver) Close

func (c *InMemoryDriver) Close(_ context.Context) error

Close is a no-op for InMemoryDriver, as there is no actual connection to close.

func (*InMemoryDriver) NewSpecStore added in v0.13.0

func (c *InMemoryDriver) NewSpecStore(_ context.Context, _ string) (spec.Store, error)

NewSpecStore creates and returns a new in-memory Spec Store.

func (*InMemoryDriver) NewValueStore added in v0.13.0

func (c *InMemoryDriver) NewValueStore(_ context.Context, _ string) (value.Store, error)

NewValueStore creates and returns a new in-memory Value Store.

type MongoDriver

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

MongoDriver represents a MongoDB connection and provides methods to interact with the database.

func (*MongoDriver) Close

func (d *MongoDriver) Close(ctx context.Context) error

Close closes the MongoDB connection.

func (*MongoDriver) NewSpecStore added in v0.13.0

func (d *MongoDriver) NewSpecStore(ctx context.Context, name string) (spec.Store, error)

NewSpecStore creates and returns a new Spec Store.

func (*MongoDriver) NewValueStore added in v0.13.0

func (d *MongoDriver) NewValueStore(ctx context.Context, name string) (value.Store, error)

NewValueStore creates and returns a new Value Store.

Jump to

Keyboard shortcuts

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