manager

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotebookNotEnabled thrown when the notebook wasn't set.
	ErrNotebookNotEnabled error = errors.New("notebook not enabled")
	// ErrElementNotFound thrown when the element was not found in the store.
	ErrElementNotFound error = errors.New("element not found")
)

Functions

This section is empty.

Types

type Manager

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

Manager handles the command admin operations.

func NewManager

func NewManager(store store, notebook notebook) (Manager, error)

NewManager returns a new Manager.

func (*Manager) Add

func (m *Manager) Add(ctx context.Context, cmd command.Command) (command.Command, error)

Add creates, saves and returns a new command validated.

func (*Manager) DeleteCommand

func (m *Manager) DeleteCommand(ctx context.Context, rawID string) error

GetCommand returns a command by ID.

func (*Manager) DeleteExplanation

func (m *Manager) DeleteExplanation(ctx context.Context, commandID uuid.UUID) error

DeleteExplanation deletes the explanation from the notebook.

func (*Manager) GetAll

func (m *Manager) GetAll(ctx context.Context) ([]command.Command, error)

GetAll returns a list with all the commands.

func (*Manager) GetOne

func (m *Manager) GetOne(ctx context.Context, rawID string) (command.Command, error)

GetCommand returns a command by ID.

func (*Manager) ReadExplanation

func (m *Manager) ReadExplanation(ctx context.Context, commandID uuid.UUID) (string, error)

ReadExplanation reads the explanation from the notebook.

func (*Manager) Search

func (m *Manager) Search(ctx context.Context, term string) ([]command.Command, error)

SearchCommand returns a list of commands with a matching term.

func (*Manager) UpdateCommand

func (m *Manager) UpdateCommand(ctx context.Context, cmd command.Command) (command.Command, error)

UpdateCommand updates the command on the store.

func (*Manager) WriteExplanation

func (m *Manager) WriteExplanation(ctx context.Context, commandID uuid.UUID, explanation string) error

WriteExplanation writes the explanation in the notebook.

Jump to

Keyboard shortcuts

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