stockaudit

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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