stockaudit

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package stockaudit checks the stock of a list of items in app stock-audit, a job: the app runs the audit once and exits, the shape of a CronJob.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auditor

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

Auditor checks the stock of the items Options lists.

func New

func New(svc stock.Service, o *Options) *Auditor

New provides the auditor with the stock service of the app, wrapped in the middlewares @Middleware lists on it. @Provide(index=0)

func (*Auditor) Run

func (a *Auditor) Run(ctx context.Context) error

Run asks the stock for each item and logs the ones that are out. A stock that fails stops the audit with its error, and the app exits 1. @Job(app=stock-audit)

type Options

type Options struct {
	Items []string `default:"book,pen,sold-out" desc:"items the audit checks"`
}

Options configures the audit. inject generates its config keys (builder.examples.simple.stockaudit.*) and provides *Options to New. @Config

Jump to

Keyboard shortcuts

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