previous

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxCount = 100

DefaultMaxCount is the default maximum number of entries kept in the list.

View Source
const (
	SetPrevious = "previous"
)

Set names for previous-event storage.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, c deleteClient, req Request, src queries.Source) error

Delete removes the stored previous-event data for the given entity. The key is deterministic from (Name, Ref, source values, FilterBy).

Types

type Request

type Request struct {
	Name           string        // variable name
	Namespace      string        // FrogoDB namespace
	Ref            string        // source key for the reference entity (e.g., "standard.user_id")
	Retrieve       string        // source key for the value to retrieve
	Exclude        string        // source key for exclude matching (optional)
	FilterBy       []string      // additional grouping fields
	EventID        string        // current event ID (for dedup)
	MaxCount       int           // max entries in list (default 100)
	TTL            time.Duration // REQUIRED. Expiration for previous-event records.
	IncludeCurrent bool
}

Request describes a previous-event query.

func (Request) Validate

func (r Request) Validate() error

Validate checks that required fields are set.

type Result

type Result struct {
	Value any  // retrieved value from previous event
	Found bool // whether a matching previous event was found
}

Result holds the outcome of a previous-event query.

func Execute

func Execute(ctx context.Context, c operateClient, req Request, src queries.Source) (Result, error)

Execute writes the current event and reads the previous event value. The order of write vs read is controlled by IncludeCurrent.

func Read

func Read(ctx context.Context, c operateClient, req Request, src queries.Source) (Result, error)

Read performs a read-only query without writing the current event.

Jump to

Keyboard shortcuts

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