flows

package
v0.6.124 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 15 Imported by: 0 modules, 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 flows is hello's side of Temporal: the hook it raises (Greet), the activities it offers to bindings (Echo, and Welcome backed by a workflow), its own workflows (GreetMany, declared for the console; Report, available for an administrative schedule) and the activities those run.

Index

Constants

View Source
const (
	Compose = "Compose"
	Total   = "Total"
	Record  = "RecordGreeting"
)

Registered activity names of the service's own workflows.

Variables

View Source
var ErrTooLong = errors.New("echo: text over 1 KiB")

ErrTooLong: Echo refuses a text over 1 KiB; retrying cannot help.

Functions

This section is empty.

Types

type EchoIn

type EchoIn struct {
	Text string `json:"text"`
}

Payloads of the hook, the activities and the workflows.

type EchoOut

type EchoOut struct {
	Text string `json:"text"`
	// Key is the execution's idempotency key (activity.InfoOf).
	Key string `json:"key"`
}

Payloads of the hook, the activities and the workflows.

type Flows

type Flows struct {
	deps.Component

	// Greet is answered by whatever backplane binds to hello.Greet.
	Greet hook.Ref[GreetIn, GreetOut]
	// contains filtered or unexported fields
}

Flows is a component: hook, activities and workflows of the service.

func New

func New(parent deps.Scope, g *greeter.Greeter, db deps.Dependency[*store.DB]) *Flows

New declares everything under parent.

func (*Flows) Echo

func (f *Flows) Echo(ctx context.Context, in EchoIn) (EchoOut, error)

Echo is the Echo activity.

func (*Flows) GreetMany

func (f *Flows) GreetMany(ctx workflow.Context, in ManyIn) (ManyOut, error)

GreetMany greets every name, in order.

func (*Flows) Report

func (f *Flows) Report(ctx workflow.Context, _ struct{}) (uint64, error)

Report logs the greetings so far; an administrator may schedule it.

func (*Flows) Welcome

func (f *Flows) Welcome(ctx workflow.Context, in GreetIn) (GreetOut, error)

Welcome is the workflow-backed activity: it may wait and call hooks. Without a binding for Greet it greets locally.

type GreetIn

type GreetIn struct {
	Name string `json:"name"`
}

Payloads of the hook, the activities and the workflows.

type GreetOut

type GreetOut struct {
	Text string `json:"text"`
}

Payloads of the hook, the activities and the workflows.

type ManyIn

type ManyIn struct {
	Names []string `json:"names"`
}

Payloads of the hook, the activities and the workflows.

type ManyOut

type ManyOut struct {
	Texts []string `json:"texts"`
}

Payloads of the hook, the activities and the workflows.

Jump to

Keyboard shortcuts

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