rule

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Command

type Command struct {
	Type   CommandType     `json:"type"`   // e.g., variable.set.add, webhook.call
	Inputs json.RawMessage `json:"inputs"` // command-specific parameters
}

Command represents a single command to be executed when a rule is triggered.

type CommandEvent

type CommandEvent struct {
	Id              string                 `json:"id"`
	Source          string                 `json:"source"`
	Subject         string                 `json:"subject"` // variable.set.add, webhook.call
	DataContentType string                 `json:"dataContentType"`
	Time            time.Time              `json:"time"`
	HubName         string                 `json:"hubName"`
	Data            map[string]interface{} `json:"data"` // Command parameters
	CorrelationId   string                 `json:"correlationId,omitempty"`
	CausationId     string                 `json:"causationId,omitempty"`
}

CommandEvent struct for workflow engine integration

type CommandType

type CommandType string
const (
	CmdVarSetAdd       CommandType = "variable.set.add"
	CmdVarSetRemove    CommandType = "variable.set.remove"
	CmdVarScalarUpdate CommandType = "variable.scalar.update"
	CmdVarMapAdd       CommandType = "variable.map.add"
	CmdVarMapRemove    CommandType = "variable.map.remove"
	CmdWebhookCall     CommandType = "webhook.call"
	CmdDeployReplay    CommandType = "replay.deploy"
	CmdCleanUpReplay   CommandType = "replay.cleanup"
)

func ParseCommandType

func ParseCommandType(s string) (CommandType, error)

func (CommandType) String

func (t CommandType) String() string

func (CommandType) Valid

func (t CommandType) Valid() bool

type Rule

type Rule struct {
	Name     string           `json:"name"`
	Trigger  triggers.Trigger `json:"-"` // not part of wire shape; handled by custom (un)marshal
	Commands []Command        `json:"commands"`
}

Rule represents a rule that triggers a set of commands when a certain event occurs.

func (Rule) MarshalJSON

func (r Rule) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Rule into JSON.

func (*Rule) UnmarshalJSON

func (r *Rule) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Rule from JSON.

Jump to

Keyboard shortcuts

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