Documentation
¶
Index ¶
- func SortByField(notifications []*github.Notification, field SortField, direction SortDirection) []*github.Notification
- type AllFilter
- type AndFilter
- type CompositeFilter
- type Engine
- func (e *Engine) Filter(ctx context.Context, notifications []*github.Notification) ([]*github.Notification, error)
- func (e *Engine) OptimizeFilter(filter Filter) Filter
- func (e *Engine) WithBatchSize(batchSize int) *Engine
- func (e *Engine) WithConcurrency(concurrency int) *Engine
- func (e *Engine) WithFilter(filter Filter) *Engine
- func (e *Engine) WithIndexing(enabled bool) *Engine
- func (e *Engine) WithTimeout(timeout time.Duration) *Engine
- type Filter
- type FilterBuilder
- type FilterFunc
- type NotFilter
- type Operator
- type OrFilter
- type OrgFilter
- type OrganizationFilter
- type ReadFilter
- type ReasonFilter
- type RegexFilter
- type RepoFilter
- type RepositoryFilter
- type SortCriterion
- type SortDirection
- type SortField
- type Sorter
- type StatusFilter
- type TextFilter
- type TimeFilter
- type TypeFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortByField ¶
func SortByField(notifications []*github.Notification, field SortField, direction SortDirection) []*github.Notification
SortByField sorts notifications by a single field
Types ¶
type AllFilter ¶
type AllFilter struct{}
AllFilter matches all notifications
func (*AllFilter) Apply ¶
func (f *AllFilter) Apply(notification *github.Notification) bool
Apply returns true for all notifications
func (*AllFilter) Description ¶
Description returns a human-readable description of the filter
type AndFilter ¶
type AndFilter struct {
// Filters is the list of filters to combine
Filters []Filter
}
AndFilter combines multiple filters with AND logic
func (*AndFilter) Apply ¶
func (f *AndFilter) Apply(notification *github.Notification) bool
Apply returns true if all filters match
func (*AndFilter) Description ¶
Description returns a human-readable description of the filter
type CompositeFilter ¶
CompositeFilter combines multiple filters with a logical operator
func (*CompositeFilter) Apply ¶
func (f *CompositeFilter) Apply(n *github.Notification) bool
Apply applies the composite filter to a notification
func (*CompositeFilter) Description ¶
func (f *CompositeFilter) Description() string
Description returns a human-readable description of the composite filter
type Engine ¶
type Engine struct {
// Concurrency controls the number of worker goroutines
Concurrency int
// BatchSize controls the size of notification batches
BatchSize int
// Timeout controls the maximum time to spend filtering
Timeout time.Duration
// FilterExpr is the filter to apply
FilterExpr Filter
// IndexEnabled controls whether to use indexing
IndexEnabled bool
// contains filtered or unexported fields
}
Engine is a high-performance notification filtering engine
func (*Engine) Filter ¶
func (e *Engine) Filter(ctx context.Context, notifications []*github.Notification) ([]*github.Notification, error)
Filter filters notifications using the configured filter
func (*Engine) OptimizeFilter ¶
OptimizeFilter optimizes a filter for better performance
func (*Engine) WithBatchSize ¶
WithBatchSize sets the batch size for the engine
func (*Engine) WithConcurrency ¶
WithConcurrency sets the concurrency for the engine
func (*Engine) WithFilter ¶
WithFilter sets the filter for the engine
func (*Engine) WithIndexing ¶
WithIndexing enables or disables indexing
type Filter ¶
type Filter interface {
// Apply applies the filter to a notification
Apply(*github.Notification) bool
// Description returns a human-readable description of the filter
Description() string
}
Filter represents a notification filter
type FilterBuilder ¶
type FilterBuilder struct {
// contains filtered or unexported fields
}
FilterBuilder helps build complex filters
func NewFilterBuilder ¶
func NewFilterBuilder() *FilterBuilder
NewFilterBuilder creates a new filter builder
func (*FilterBuilder) And ¶
func (b *FilterBuilder) And(filter Filter) *FilterBuilder
And adds a filter with AND logic
func (*FilterBuilder) Not ¶
func (b *FilterBuilder) Not(filter Filter) *FilterBuilder
Not adds a filter with NOT logic
func (*FilterBuilder) Or ¶
func (b *FilterBuilder) Or(filter Filter) *FilterBuilder
Or adds a filter with OR logic
type FilterFunc ¶
type FilterFunc func(*github.Notification) bool
FilterFunc is a function that filters notifications
type NotFilter ¶
type NotFilter struct {
// Filter is the filter to negate
Filter Filter
}
NotFilter negates a filter
func (*NotFilter) Apply ¶
func (f *NotFilter) Apply(notification *github.Notification) bool
Apply returns true if the filter does not match
func (*NotFilter) Description ¶
Description returns a human-readable description of the filter
type OrFilter ¶
type OrFilter struct {
// Filters is the list of filters to combine
Filters []Filter
}
OrFilter combines multiple filters with OR logic
func (*OrFilter) Apply ¶
func (f *OrFilter) Apply(notification *github.Notification) bool
Apply returns true if any filter matches
func (*OrFilter) Description ¶
Description returns a human-readable description of the filter
type OrgFilter ¶
type OrgFilter struct {
// Org is the organization name to match
Org string
}
OrgFilter filters notifications by organization
func (*OrgFilter) Apply ¶
func (f *OrgFilter) Apply(notification *github.Notification) bool
Apply returns true if the notification is from the specified organization
func (*OrgFilter) Description ¶
Description returns a human-readable description of the filter
type OrganizationFilter ¶
OrganizationFilter filters notifications by organization name
func NewOrganizationFilter ¶
func NewOrganizationFilter(pattern string) (*OrganizationFilter, error)
NewOrganizationFilter creates a new organization filter
func (*OrganizationFilter) Apply ¶
func (f *OrganizationFilter) Apply(n *github.Notification) bool
Apply applies the organization filter to a notification
func (*OrganizationFilter) Description ¶
func (f *OrganizationFilter) Description() string
Description returns a human-readable description of the organization filter
type ReadFilter ¶
type ReadFilter struct {
// Read is true to match read notifications, false to match unread
Read bool
}
ReadFilter filters notifications by read status
func (*ReadFilter) Apply ¶
func (f *ReadFilter) Apply(notification *github.Notification) bool
Apply returns true if the notification matches the read status
func (*ReadFilter) Description ¶
func (f *ReadFilter) Description() string
Description returns a human-readable description of the filter
type ReasonFilter ¶
type ReasonFilter struct {
// Reason is the notification reason to match
Reason string
}
ReasonFilter filters notifications by reason
func (*ReasonFilter) Apply ¶
func (f *ReasonFilter) Apply(notification *github.Notification) bool
Apply returns true if the notification has the specified reason
func (*ReasonFilter) Description ¶
func (f *ReasonFilter) Description() string
Description returns a human-readable description of the filter
type RegexFilter ¶
RegexFilter filters notifications by a regular expression
func NewRegexFilter ¶
func NewRegexFilter(pattern string, field string) (*RegexFilter, error)
NewRegexFilter creates a new regex filter
func (*RegexFilter) Apply ¶
func (f *RegexFilter) Apply(n *github.Notification) bool
Apply applies the regex filter to a notification
func (*RegexFilter) Description ¶
func (f *RegexFilter) Description() string
Description returns a human-readable description of the regex filter
type RepoFilter ¶
type RepoFilter struct {
// Repo is the repository name to match
Repo string
}
RepoFilter filters notifications by repository
func (*RepoFilter) Apply ¶
func (f *RepoFilter) Apply(notification *github.Notification) bool
Apply returns true if the notification is from the specified repository
func (*RepoFilter) Description ¶
func (f *RepoFilter) Description() string
Description returns a human-readable description of the filter
type RepositoryFilter ¶
RepositoryFilter filters notifications by repository name
func NewRepositoryFilter ¶
func NewRepositoryFilter(pattern string) (*RepositoryFilter, error)
NewRepositoryFilter creates a new repository filter
func (*RepositoryFilter) Apply ¶
func (f *RepositoryFilter) Apply(n *github.Notification) bool
Apply applies the repository filter to a notification
func (*RepositoryFilter) Description ¶
func (f *RepositoryFilter) Description() string
Description returns a human-readable description of the repository filter
type SortCriterion ¶
type SortCriterion struct {
Field SortField
Direction SortDirection
}
SortCriterion represents a criterion for sorting
func NewSortCriterion ¶
func NewSortCriterion(field SortField, direction SortDirection) SortCriterion
NewSortCriterion creates a new sort criterion
type SortDirection ¶
type SortDirection int
SortDirection represents the direction of sorting
const ( // Ascending sorts in ascending order Ascending SortDirection = iota // Descending sorts in descending order Descending )
type SortField ¶
type SortField string
SortField represents a field to sort by
const ( // SortByRepository sorts by repository name SortByRepository SortField = "repository" // SortByType sorts by notification type SortByType SortField = "type" // SortByTitle sorts by notification title SortByTitle SortField = "title" // SortByTime sorts by notification time SortByTime SortField = "time" // SortByStatus sorts by notification status SortByStatus SortField = "status" // SortByReason sorts by notification reason SortByReason SortField = "reason" )
type Sorter ¶
type Sorter struct {
// Criteria is the list of sort criteria
Criteria []SortCriterion
// Parallel controls whether to use parallel sorting
Parallel bool
// BatchSize controls the size of notification batches for parallel sorting
BatchSize int
}
Sorter sorts notifications
func (*Sorter) Sort ¶
func (s *Sorter) Sort(notifications []*github.Notification) []*github.Notification
Sort sorts the notifications
func (*Sorter) WithBatchSize ¶
WithBatchSize sets the batch size for parallel sorting
func (*Sorter) WithCriteria ¶
func (s *Sorter) WithCriteria(criteria ...SortCriterion) *Sorter
WithCriteria sets the sort criteria
func (*Sorter) WithParallel ¶
WithParallel enables or disables parallel sorting
type StatusFilter ¶
type StatusFilter struct {
Unread bool
}
StatusFilter filters notifications by read status
func NewStatusFilter ¶
func NewStatusFilter(unread bool) *StatusFilter
NewStatusFilter creates a new status filter
func (*StatusFilter) Apply ¶
func (f *StatusFilter) Apply(n *github.Notification) bool
Apply applies the status filter to a notification
func (*StatusFilter) Description ¶
func (f *StatusFilter) Description() string
Description returns a human-readable description of the status filter
type TextFilter ¶
type TextFilter struct {
// Text is the text to search for
Text string
}
TextFilter filters notifications by text
func (*TextFilter) Apply ¶
func (f *TextFilter) Apply(notification *github.Notification) bool
Apply returns true if the notification contains the specified text
func (*TextFilter) Description ¶
func (f *TextFilter) Description() string
Description returns a human-readable description of the filter
type TimeFilter ¶
TimeFilter filters notifications by time
func (*TimeFilter) Apply ¶
func (f *TimeFilter) Apply(n *github.Notification) bool
Apply applies the time filter to a notification
func (*TimeFilter) Description ¶
func (f *TimeFilter) Description() string
Description returns a human-readable description of the time filter
func (*TimeFilter) WithBefore ¶
func (f *TimeFilter) WithBefore(before time.Time) *TimeFilter
WithBefore adds a before time to the filter
func (*TimeFilter) WithSince ¶
func (f *TimeFilter) WithSince(since time.Time) *TimeFilter
WithSince adds a since time to the filter
type TypeFilter ¶
type TypeFilter struct {
Types []string
}
TypeFilter filters notifications by type
func NewTypeFilter ¶
func NewTypeFilter(types ...string) *TypeFilter
NewTypeFilter creates a new type filter
func (*TypeFilter) Apply ¶
func (f *TypeFilter) Apply(n *github.Notification) bool
Apply applies the type filter to a notification
func (*TypeFilter) Description ¶
func (f *TypeFilter) Description() string
Description returns a human-readable description of the type filter