handlers

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: AGPL-3.0 Imports: 10 Imported by: 1

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, 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) 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) 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) 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) 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) error

SetStringValue sets a string value and logs an audit entry.

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"`
}

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