2023-04-24 20:52:12 +02:00
|
|
|
package queue
|
|
|
|
|
2023-07-05 21:54:01 +02:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
2023-06-13 03:57:13 +02:00
|
|
|
|
|
|
|
type Options struct {
|
|
|
|
TemplateDir string
|
|
|
|
DefaultKeepAlive time.Duration
|
|
|
|
}
|
2023-04-24 20:52:12 +02:00
|
|
|
|
|
|
|
type OptionFunc func(*Options)
|
|
|
|
|
|
|
|
func defaultOptions() *Options {
|
2023-06-13 03:57:13 +02:00
|
|
|
return &Options{
|
|
|
|
TemplateDir: "./templates",
|
|
|
|
DefaultKeepAlive: time.Minute,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithTemplateDir(templateDir string) OptionFunc {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.TemplateDir = templateDir
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithDefaultKeepAlive(keepAlive time.Duration) OptionFunc {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.DefaultKeepAlive = keepAlive
|
|
|
|
}
|
2023-04-24 20:52:12 +02:00
|
|
|
}
|