github.com/blend/go-sdk@v1.20220411.3/cron/schedule.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 import ( 11 "time" 12 ) 13 14 // Schedule is a type that provides a next runtime after a given previous runtime. 15 type Schedule interface { 16 // GetNextRuntime should return the next runtime after a given previous runtime. If `after` is time.Time{} it should be assumed 17 // the job hasn't run yet. If time.Time{} is returned by the schedule it is inferred that the job should not run again. 18 Next(time.Time) time.Time 19 } 20 21 // ScheduleFunc is a function that implements schedule. 22 type ScheduleFunc func(time.Time) time.Time 23 24 // Next implements schedule. 25 func (sf ScheduleFunc) Next(after time.Time) time.Time { 26 return sf(after) 27 }