batch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 6 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 {
	Cmd  string         `json:"cmd"`
	Args map[string]any `json:"args"`
}

Command represents a single batch command.

func ParseJSONL

func ParseJSONL(r io.Reader) ([]Command, error)

ParseJSONL reads JSONL from reader and returns commands.

type Executor

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

Executor runs batch commands.

func NewExecutor

func NewExecutor(client *api.Client, parallel int, continueOnError bool) *Executor

NewExecutor creates a batch executor.

func (*Executor) Execute

func (e *Executor) Execute(commands []Command) Summary

Execute runs all commands and returns a summary.

func (*Executor) SetProgress

func (e *Executor) SetProgress(fn ProgressFunc)

SetProgress sets the progress callback.

type ProgressFunc

type ProgressFunc func(done, total int)

ProgressFunc is called after each command completes.

type Result

type Result struct {
	Index   int    `json:"index"`
	Cmd     string `json:"cmd"`
	Success bool   `json:"success"`
	Data    any    `json:"data,omitempty"`
	Error   string `json:"error,omitempty"`
}

Result represents the outcome of a command.

type Summary

type Summary struct {
	Total   int      `json:"total"`
	Success int      `json:"success"`
	Failed  int      `json:"failed"`
	Results []Result `json:"results"`
}

Summary is the batch output envelope.

Jump to

Keyboard shortcuts

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