events

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidType = errors.New("events: invalid type")

Functions

func PurgeOldEvents

func PurgeOldEvents(ctx context.Context, retention time.Duration) (int, error)

PurgeOldEvents deletes MovieEvent rows whose create_time is older than (now - retention). Returns the number of rows deleted.

func Record

func Record(
	ctx context.Context,
	client *ent.Client,
	t Type,
	movieID uint32,
	payload map[string]any,
) error

Record writes a MovieEvent row. When client is nil the package default (set by Register at db-client construction) is used. Pass the bound client from a mutation (m.Client()) or transaction (tx.Client()) to participate in an existing tx — ent routes the write through the tx automatically.

func Register

func Register(client *ent.Client)

Register installs runtime mutation hooks on the supplied client and captures it as the package default for tx-less Record calls.

Types

type Type

type Type string
const (
	TypeGrabbed           Type = "grabbed"
	TypeDownloadCompleted Type = "download_completed"
	TypeDownloadFailed    Type = "download_failed"
	TypeImported          Type = "imported"
	TypeImportFailed      Type = "import_failed"
	TypeDriftDetected     Type = "drift_detected"
	TypeDriftConfirmed    Type = "drift_confirmed"
	TypeSearched          Type = "searched"
)

func (Type) Valid

func (t Type) Valid() bool

Jump to

Keyboard shortcuts

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