event

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package event is ynf's one event envelope (ADR-002): every adapter, push or pull, and ynf itself emits a CloudEvents 1.0 event with a type from ynf's closed vocabulary.

Index

Constants

View Source
const (
	TicketMatched = "ynf.ticket.matched" // a lane's search found the ticket
	RunFinished   = "ynf.run.finished"   // a runner finished; data carries the outcome
	TimerDue      = "ynf.timer.due"      // the item's next_due passed
	ActionDone    = "ynf.action.done"    // a forge action completed; data carries what it produced
	ForgeChanged  = "ynf.forge.changed"  // a webhook says something about the item changed; facts are re-probed
)

Types are ynf's closed vocabulary. Provider event names never reach the decider.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	SpecVersion string         `json:"specversion"`
	ID          string         `json:"id"`
	Source      string         `json:"source"`
	Type        string         `json:"type"`
	Subject     string         `json:"subject"`
	Time        time.Time      `json:"time"`
	Data        map[string]any `json:"data,omitempty"`
}

Event is a CloudEvents 1.0 envelope.

func New

func New(id, source, typ, subject string, at time.Time, data map[string]any) Event

New returns an event with the spec version set.

func (Event) Bool

func (e Event) Bool(key string) bool

Bool reads a bool field from Data, or false.

func (Event) Str

func (e Event) Str(key string) string

Str reads a string field from Data, or "".

func (Event) String

func (e Event) String() string

String reads well in logs.

Jump to

Keyboard shortcuts

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