Rename QEntrySortConfig to QSortConfig

This commit is contained in:
Jan Philipp Timme 2019-01-01 21:23:04 +01:00
parent 187164fc7d
commit 6749bdbb96
3 changed files with 8 additions and 8 deletions

View File

@ -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
}

View File

@ -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())

View File

@ -12,7 +12,7 @@ import (
)
type shellState struct {
SortConfig mailq.QEntrySortConfig
SortConfig mailq.QSortConfig
QuitShell bool
Queue mailq.MailQ
}