alertmanager/cli/format/sort.go
Simon Pasquier c92ed69ce8 Split cli package (#1314)
* cli: move commands to cli/cmd

* cli: use StatusAPI interface for config command

* cli: use SilenceAPI interface for silence commands

* cli: use AlertAPI for alert command

* cli: move back commands to cli package

And move API client code to its own package.

* cli: remove unused structs
2018-04-11 11:17:41 +02:00

19 lines
602 B
Go

package format
import (
"github.com/prometheus/alertmanager/client"
"github.com/prometheus/alertmanager/types"
)
type ByEndAt []types.Silence
func (s ByEndAt) Len() int { return len(s) }
func (s ByEndAt) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s ByEndAt) Less(i, j int) bool { return s[i].EndsAt.Before(s[j].EndsAt) }
type ByStartsAt []*client.ExtendedAlert
func (s ByStartsAt) Len() int { return len(s) }
func (s ByStartsAt) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s ByStartsAt) Less(i, j int) bool { return s[i].StartsAt.Before(s[j].StartsAt) }