handlers

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: AGPL-3.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerAdapter

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

HandlerAdapter is a wrapper for handling variable operations. Functions of HandlerAdapter execute the provided valkey commands and logs audit entries. Common functions arguments: ctx is the context for the request. variableKey is the key for the Valkey data type. hubName is the name of the associated hub, used for namespacing. value is the element to be added to the data type. correlationId is used for tracking and auditing purposes.

func NewHandlerAdapter

func NewHandlerAdapter(client valkey.Client, logger *zap.Logger, pub publisher.Publisher, opts ...variables.ValkeyAdapterOption) *HandlerAdapter

NewHandlerAdapter creates a new wrapper for handling variable operations.

func (*HandlerAdapter) AddElementToSet

func (r *HandlerAdapter) AddElementToSet(ctx context.Context, variableKey string, hubName string, value string, correlationId string, recursionDepth int) error

AddElementToSet adds an element to a Set data type and logs an audit entry.

func (*HandlerAdapter) RemoveElementFromSet

func (r *HandlerAdapter) RemoveElementFromSet(ctx context.Context, variableKey string, hubName string, value string, correlationId string, recursionDepth int) error

RemoveElementFromSet removes an element from a Set data type and logs an audit entry.

func (*HandlerAdapter) RemoveMapEntry added in v0.2.4

func (r *HandlerAdapter) RemoveMapEntry(ctx context.Context, variableKey string, hubName string, field string, correlationId string, recursionDepth int) error

RemoveMapEntry removes a field from a map data type and logs an audit entry. It uses Valkey's HDEL command on a Hash data type under the hood.

func (*HandlerAdapter) SetMapEntry added in v0.2.4

func (r *HandlerAdapter) SetMapEntry(ctx context.Context, variableKey string, hubName string, field string, value string, correlationId string, recursionDepth int) error

SetMapEntry sets a field-value pair in a map data type and logs an audit entry. It is using Valkey's HSET command on a Hash data type under the hood. This command overwrites the values of specified fields that exist in the hash. If key doesn't exist, a new key holding a hash is created.

func (*HandlerAdapter) SetStringValue added in v0.1.6

func (r *HandlerAdapter) SetStringValue(ctx context.Context, variableKey string, hubName string, value string, correlationId string, recursionDepth int) error

SetStringValue sets a string value and logs an audit entry.

type PublishVarUpdateParams added in v0.2.8

type PublishVarUpdateParams struct {
	Hub            string
	VarName        string
	VarType        string // "set" | "map" | "string" | "int" | "boolean" | ...
	Action         string // "added" | "removed" | "set"
	Data           any    // value or {"field":..., "value":...} or {"field":...} for remove
	CorrelationID  string
	Source         string // e.g. "eventhub" or your worker name
	RecursionDepth int
}

type StoreVariableAction

type StoreVariableAction struct {
	HubName        string `json:"hub_name"`
	EventId        string `json:"event_id"`
	Operation      string `json:"operation"`
	Target         string `json:"target"`
	VariableRef    string `json:"variable_ref"`
	Variable       string `json:"variable"`
	CorrelationId  string `json:"correlation_id"`
	RecursionDepth int    `json:"recursion_depth"`
}

func (StoreVariableAction) ToSequence

func (action StoreVariableAction) ToSequence() iter.Seq2[string, string]

Jump to

Keyboard shortcuts

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