go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/cron/never.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package cron 9 10 import ( 11 "fmt" 12 "time" 13 ) 14 15 var ( 16 _ Schedule = (*NeverSchedule)(nil) 17 _ fmt.Stringer = (*NeverSchedule)(nil) 18 ) 19 20 // Never returns a never schedule. 21 func Never() NeverSchedule { return NeverSchedule{} } 22 23 // NeverSchedule is a schedule that never runs. 24 type NeverSchedule struct{} 25 26 // Next implements Schedule 27 func (ns NeverSchedule) Next(_ time.Time) time.Time { return time.Time{} } 28 29 // String implements fmt.Stringer. 30 func (ns NeverSchedule) String() string { return StringScheduleNever }