plugins

package
v0.0.0-...-8f6c52d Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseExtractor

type BaseExtractor[Opts any, Feature db.Table] struct {
	// Options to pass via yaml to this step.
	libconf.JsonOpts[Opts]
	// Database connection.
	DB             db.DB
	RecencySeconds int
	UpdatedAt      *time.Time
}

Common base for all extractors that provides some functionality that would otherwise be duplicated across all extractors.

func (*BaseExtractor[Opts, F]) ExtractSQL

func (e *BaseExtractor[Opts, F]) ExtractSQL(query string) ([]Feature, error)

Extract the features directly from an sql query.

func (*BaseExtractor[Opts, F]) Extracted

func (e *BaseExtractor[Opts, F]) Extracted(fs []F) ([]Feature, error)

Replace all features of the given model in the database and return them as a slice of generic features for counting.

func (*BaseExtractor[Opts, Feature]) Init

func (e *BaseExtractor[Opts, Feature]) Init(db db.DB, conf conf.FeatureExtractorConfig) error

Init the extractor with the database and options.

func (*BaseExtractor[Opts, F]) MarkAsUpdated

func (e *BaseExtractor[Opts, F]) MarkAsUpdated()

Mark the extractor as updated by setting the UpdatedAt field to the current time.

func (*BaseExtractor[Opts, F]) NeedsUpdate

func (e *BaseExtractor[Opts, F]) NeedsUpdate() bool

Checks if the last update of the extractor is older than the configured recency. If the recency is set to a positive value, it will return true if the last update is older than the configured recency in seconds.

func (*BaseExtractor[Opts, F]) NextPossibleExecution

func (e *BaseExtractor[Opts, F]) NextPossibleExecution() time.Time

func (*BaseExtractor[Opts, F]) NotifySkip

func (e *BaseExtractor[Opts, F]) NotifySkip()

type Feature

type Feature any

type FeatureExtractor

type FeatureExtractor interface {
	// Configure the feature extractor with a database and options.
	// This function should also create the needed database structures.
	Init(db db.DB, conf conf.FeatureExtractorConfig) error
	// Extract features from the given data.
	Extract() ([]Feature, error)
	// Get the name of this feature extractor.
	// This name is used to identify the extractor in metrics, config, logs, etc.
	// Should be something like: "my_cool_feature_extractor".
	GetName() string
	// Get message topics that trigger a re-execution of this extractor.
	Triggers() []string
	// Check if the extractors last update is older than the configured recency.
	NeedsUpdate() bool
	// Update the last update timestamp of the extractor.
	MarkAsUpdated()
	// Earliest time when this extractor can be executed again.
	NextPossibleExecution() time.Time
	// Skip the extractor if it is not needed.
	NotifySkip()
}

Each feature extractor must conform to this interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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