persistent

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterPreset

type FilterPreset struct {
	// Name is the name of the preset
	Name string `json:"name"`
	// Description is a human-readable description
	Description string `json:"description,omitempty"`
	// Expression is the filter expression
	Expression string `json:"expression"`
	// Created is when the preset was created
	Created time.Time `json:"created"`
	// LastUsed is when the preset was last used
	LastUsed time.Time `json:"last_used,omitempty"`
	// UseCount is how many times the preset has been used
	UseCount int `json:"use_count"`
	// Parent is the name of the parent preset (for inheritance)
	Parent string `json:"parent,omitempty"`
	// Tags are optional tags for categorizing presets
	Tags []string `json:"tags,omitempty"`
}

FilterPreset represents a saved filter preset

type FilterStore

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

FilterStore manages saved filter presets

func NewFilterStore

func NewFilterStore(configManager *config.ConfigManager) (*FilterStore, error)

NewFilterStore creates a new filter store

func (*FilterStore) Delete

func (s *FilterStore) Delete(name string) error

Delete deletes a filter preset

func (*FilterStore) Get

func (s *FilterStore) Get(name string) (*FilterPreset, error)

Get gets a filter preset by name

func (*FilterStore) List

func (s *FilterStore) List() []*FilterPreset

List lists all filter presets

func (*FilterStore) ListShortcuts

func (s *FilterStore) ListShortcuts() map[string]string

ListShortcuts lists all shortcuts

func (*FilterStore) Load

func (s *FilterStore) Load() error

Load loads filter presets from disk

func (*FilterStore) Save

func (s *FilterStore) Save(preset *FilterPreset) error

Save saves a filter preset

type Parser

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

Parser parses filter expressions into Filter objects

func NewParser

func NewParser(store *FilterStore) *Parser

NewParser creates a new parser

func (*Parser) Parse

func (p *Parser) Parse(expr string) (filter.Filter, error)

Parse parses a filter expression into a Filter

type ScoreFilter

type ScoreFilter struct {
	// MinScore is the minimum score to match (inclusive)
	MinScore int
	// MaxScore is the maximum score to match (inclusive)
	MaxScore int
	// Scorer is the scorer to use
	Scorer *scoring.Scorer
	// Scores is a cache of notification scores
	Scores map[string]*scoring.NotificationScore
}

ScoreFilter filters notifications by score

func NewScoreFilter

func NewScoreFilter(minScore, maxScore int, scorer *scoring.Scorer) *ScoreFilter

NewScoreFilter creates a new score filter

func (*ScoreFilter) Apply

func (f *ScoreFilter) Apply(n *github.Notification) bool

Apply applies the score filter to a notification

func (*ScoreFilter) Description

func (f *ScoreFilter) Description() string

Description returns a human-readable description of the filter

func (*ScoreFilter) GetScores

func (f *ScoreFilter) GetScores() map[string]*scoring.NotificationScore

GetScores gets the scores for notifications

func (*ScoreFilter) SetScores

func (f *ScoreFilter) SetScores(scores map[string]*scoring.NotificationScore)

SetScores sets the scores for notifications

type Token

type Token struct {
	// Type is the token type
	Type string
	// Value is the token value
	Value string
}

Token represents a token in a filter expression

Jump to

Keyboard shortcuts

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