github.com/blend/go-sdk@v1.20220411.3/cron/sort.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package cron 9 10 // JobSchedulersByJobNameAsc is a wrapper that sorts job schedulers 11 // by the job name ascending. 12 type JobSchedulersByJobNameAsc []*JobScheduler 13 14 // Len implements sorter. 15 func (s JobSchedulersByJobNameAsc) Len() int { 16 return len(s) 17 } 18 19 // Swap implements sorter. 20 func (s JobSchedulersByJobNameAsc) Swap(i, j int) { 21 s[i], s[j] = s[j], s[i] 22 } 23 24 // Less implements sorter. 25 func (s JobSchedulersByJobNameAsc) Less(i, j int) bool { 26 return s[i].Name() < s[j].Name() 27 }