Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Archive bool
Delete bool
MarkImportant bool
MarkRead bool
Category config.Category
AddLabel string
}
Action represents an action associated with a Gmail filter.
type Filter ¶
type Filter struct {
// ID is an optional identifier associated with a filter.
ID string
Action Action
Criteria Criteria
}
Filter matches 1:1 a filter created on Gmail.
type Filters ¶
type Filters []Filter
Filters is a list of filters created in Gmail.
func FromConfig ¶
FromConfig translates a config into entries that map directly into Gmail filters
func FromConfigRule ¶
FromConfigRule creates a set of filters based on a single config Rule
type FiltersDiff ¶
FiltersDiff contains filters that have been added and removed locally with respect to upstream.
func Diff ¶
func Diff(upstream, local Filters) (FiltersDiff, error)
Diff computes the diff between two lists of filters.
To compute the diff, IDs are ignored, only the contents of the filters are actually considered.
func NewMinimalFiltersDiff ¶
func NewMinimalFiltersDiff(added, removed Filters) FiltersDiff
NewMinimalFiltersDiff creates a new FiltersDiff with reordered filters, where similar added and removed ones are next to each other.
The algorithm used is a quadratic approximation to the otherwise NP-complete travel salesman problem. Hopefully the number of filters is low enough to make this not too slow and the approximation not too bad.
func (FiltersDiff) Empty ¶
func (f FiltersDiff) Empty() bool
Empty returns true if the diff is empty.
func (FiltersDiff) String ¶
func (f FiltersDiff) String() string