Rename QEntrySortConfig to QSortConfig
This commit is contained in:
parent
187164fc7d
commit
6749bdbb96
|
@ -6,7 +6,7 @@ import (
|
|||
"sort"
|
||||
)
|
||||
|
||||
type QEntrySortConfig struct {
|
||||
type QSortConfig struct {
|
||||
attributes []qEntryAttributeSortConfig
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@ type qEntryAttributeSortConfig struct {
|
|||
order string
|
||||
}
|
||||
|
||||
func NewSortConfig() QEntrySortConfig {
|
||||
return QEntrySortConfig{}
|
||||
func NewSortConfig() QSortConfig {
|
||||
return QSortConfig{}
|
||||
}
|
||||
|
||||
func isQEntryAttribute(attributeName string) bool {
|
||||
|
@ -30,7 +30,7 @@ func isQEntryAttribute(attributeName string) bool {
|
|||
return isValidAttribute
|
||||
}
|
||||
|
||||
func (c QEntrySortConfig) By(attributeName string, order string) (QEntrySortConfig, error) {
|
||||
func (c QSortConfig) By(attributeName string, order string) (QSortConfig, error) {
|
||||
if !isQEntryAttribute(attributeName) {
|
||||
return c, errors.New(fmt.Sprintf("Invalid sort attribute: '%s' given!", attributeName))
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ func (c QEntrySortConfig) By(attributeName string, order string) (QEntrySortConf
|
|||
return c, nil
|
||||
}
|
||||
|
||||
func (queue MailQ) Sort(config QEntrySortConfig) {
|
||||
func (queue MailQ) Sort(config QSortConfig) {
|
||||
if len(config.attributes) == 0 {
|
||||
return
|
||||
}
|
||||
|
|
4
main.go
4
main.go
|
@ -39,7 +39,7 @@ func parseArguments() {
|
|||
settings["usePager"] = strconv.FormatBool(*usePagerPtr)
|
||||
}
|
||||
|
||||
func defaultSortConfig() mailq.QEntrySortConfig {
|
||||
func defaultSortConfig() mailq.QSortConfig {
|
||||
sortConfig := mailq.NewSortConfig()
|
||||
sortConfig, _ = sortConfig.By("Status", "ASC")
|
||||
sortConfig, _ = sortConfig.By("Sender", "ASC")
|
||||
|
@ -47,7 +47,7 @@ func defaultSortConfig() mailq.QEntrySortConfig {
|
|||
return sortConfig
|
||||
}
|
||||
|
||||
func showQueue(sortConfig mailq.QEntrySortConfig) {
|
||||
func showQueue(sortConfig mailq.QSortConfig) {
|
||||
queue, err := fetchQueue()
|
||||
if err != nil {
|
||||
fmt.Printf("Could not fetch queue entries: %s\n", err.Error())
|
||||
|
|
Loading…
Reference in New Issue