Help us shape the future of Go! Take the 2026 Go Developer Survey

batches

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrowserStatus added in v1.44.2

func BrowserStatus(batch gjson.Result) (string, string)

BrowserStatus keeps detail presentation consistent with the browser overview.

func Configure

func Configure(root *cli.Command, options Options)

Configure registers local batch workflows around the generated commands.

func InterruptedError

func InterruptedError(failure error) bool

InterruptedError reports cancellation or timeout of a local batch workflow.

func RunBatchDirectoryHelper

func RunBatchDirectoryHelper(args []string) (bool, error)

RunBatchDirectoryHelper creates a directory without changing the parent's umask or changing permissions through a replaceable pathname.

func RunBatchOutputHelper

func RunBatchOutputHelper(args []string) (bool, error)

RunBatchOutputHelper handles the private byte-copy process before CLI parsing. The helper owns no API client or saved files. Its lifeline stops blocked writes if the parent disappears, without changing the inherited stdout descriptor.

func ShowNextCommand

func ShowNextCommand(batch gjson.Result, opts HintOptions) error

ShowNextCommand renders a safe follow-up hint after batch creation.

func SubmissionErrorValue added in v1.44.2

func SubmissionErrorValue(err error, value gjson.Result) gjson.Result

SubmissionErrorValue retains recovery data alongside the original API error. Only the new submit workflow adds this envelope; existing commands stay unchanged.

func WithErrorOutput

func WithErrorOutput(failure error, out io.Writer, render func(context.Context, io.Writer) error) error

WithErrorOutput gives cancellation diagnostics a separate bounded delivery window. A failed delivery must not trigger another unbounded write to the same error sink.

func WorkflowErrorMessage added in v1.44.2

func WorkflowErrorMessage(failure error) string

WorkflowErrorMessage retains safe outcome and cleanup messages from joined failures. Arbitrary cause text remains available through explicit error modes.

Types

type HintOptions

type HintOptions struct {
	Context       context.Context
	Route         string
	Response      bool
	Terminal      bool
	Transform     string
	RawOutput     bool
	Format        string
	Stderr        io.Writer
	HumanTerminal func(context.Context, *cli.Command) bool
}

HintOptions carries the final destination and format policy for batch receipts.

type Options

type Options struct {
	DefaultRequestOptions func(*cli.Command) []option.RequestOption
	RequestOptions        func(*cli.Command, io.Reader) ([]option.RequestOption, error)
	CreateRequestOptions  func(*cli.Command, io.Reader) ([]option.RequestOption, gjson.Result, error)
	ShowResult            func(context.Context, *cli.Command, gjson.Result, string, io.Writer, io.Writer) error
	ShowRecords           func(context.Context, *cli.Command, RecordOutput, io.Writer, io.Writer) error
	ShowBrowserDetails    func(context.Context, gjson.Result, io.Writer, func(RecordTextStyle)) error
	HumanTerminal         func(context.Context, *cli.Command) bool
	APIErrorMessage       func(*cli.Command, error, *openai.Error) string
}

Options connects batch workflows to application request and presentation policies. Assembly supplies every callback, retaining feature middleware and output policy.

type RecordItem added in v1.44.2

type RecordItem struct {
	Kind      string
	WriteJSON func(io.Writer) error
}

RecordItem exposes one stored record, or a group's matching metadata. WriteJSON streams that item without retaining its payload or duplicate group. The visitor must finish reading before its callback returns.

type RecordOutput added in v1.44.2

type RecordOutput struct {
	Operation             string
	WriteJSON             func(io.Writer) error
	TemporaryFile         func() (*os.File, func() error, error)
	BatchID, File, FileID string
	Visit                 func(func(RecordItem) error) error
	// StopSource interrupts an active download after presentation fails.
	// Stored records need no interruption and leave this callback nil.
	StopSource context.CancelCauseFunc
	// Detail omits repeated file metadata inside an already labeled browser pane.
	Detail bool
	// Decorate marks trusted presentation spans in one bounded browser projection.
	// Raw, standalone, and complete streaming fallback output do not use it.
	Decorate func(RecordTextStyle)
}

RecordOutput lets presentation stream validated records and borrow private scratch storage for unusually large labels. The workflow owns all cleanup.

type RecordTextStyle added in v1.44.2

type RecordTextStyle struct {
	Start, End int64
	Role       string
}

type WorkflowError

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

WorkflowError contains only local guidance, never API prose or paths.

func (*WorkflowError) Error

func (e *WorkflowError) Error() string

func (*WorkflowError) ExitCode

func (e *WorkflowError) ExitCode() int

func (*WorkflowError) Unwrap

func (e *WorkflowError) Unwrap() error

Jump to

Keyboard shortcuts

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