report

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 2 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 {
	ID            uuid.UUID
	Name          string
	AggregateName string
	AggregateID   uuid.UUID
	Payload       any
}

Command represents a command to be executed in a system. It contains an ID, name, aggregate name, aggregate ID, and payload. A Report provides information about the execution of a Command, including the Command itself, runtime duration, and any errors encountered during execution. New creates a new Report with the given Command and options. Options include Runtime to specify the runtime of a Command execution and Error to add the execution error of a Command to a Report.

type Option

type Option func(*Report)

Option is a Report option.

func Error

func Error(err error) Option

Error returns a ReportOption that adds the execution error of a Command to a Report.

func Runtime

func Runtime(d time.Duration) Option

Runtime returns an Option that specifies the runtime of a Command execution.

type Report

type Report struct {
	Command Command
	Runtime time.Duration
	Error   error
}

A Report provides information about the execution of a Command.

func New

func New(cmd Command, opts ...Option) Report

New returns a new Report that is filled with the information from opts.

func (*Report) Report

func (r *Report) Report(rep Report)

Report.Report updates the Report instance with the information from the provided Report instance. It creates a new Report based on the Command in the provided Report, and updates the runtime and error information. This method is useful for aggregating multiple Reports into a single Report.

Jump to

Keyboard shortcuts

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