struct-task

command
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

struct-task — Struct / Method Receiver Style

Demonstrates a struct with injected dependencies (OpenAIClient, Database) that implements durable.Task directly via an Exec method.

Idiomatic pattern for production services where dependencies are constructed once and reused across task runs. Also shows WithTaskTimeout, WithTaskMaxRetries, WithTag, and WithAutoPurge.

Run

go run .

Reset

rm -rf examples/struct-task/.data/

Documentation

Overview

Package main demonstrates the struct / method-receiver style of durable-go. AgentRunner is a production-style struct with injected dependencies. It implements durable.Task[AgentInput, AgentOutput] so it can be passed directly to RegisterTask.

Jump to

Keyboard shortcuts

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