storage

package
v0.0.0-...-75be81d Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Operation string
	Params    []Param
	Meta      map[string]any
}

type Document

type Document = map[string]any

type MongoStorage

type MongoStorage struct {
	Collection *mongo.Collection
	Logger     *slog.Logger
}

func (*MongoStorage) Exec

func (s *MongoStorage) Exec(ctx context.Context, command Command) ([]Document, error)

Exec runs commands as described at https://www.mongodb.com/docs/manual/reference/command/

All commands are collection local, so you can't make cross-collection aggregation TODO: might be a good idea to allow cross-collection requests

func (*MongoStorage) Settings

func (s *MongoStorage) Settings(ctx context.Context) (Settings, error)

type Param

type Param struct {
	Name  string
	Value any
}

type Settings

type Settings struct {
	Type string
	Meta map[string]any
}

type Storage

type Storage interface {
	Settings(ctx context.Context) (Settings, error)
	Exec(ctx context.Context, command Command) ([]Document, error)
}

Jump to

Keyboard shortcuts

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