20 lines
350 B
Go
20 lines
350 B
Go
package state
|
|
|
|
import (
|
|
"time"
|
|
|
|
"code.icb4dc0.de/buildr/buildr/modules/state/ent"
|
|
)
|
|
|
|
type EntryOptionFunc func(e *ent.KVEntryCreate)
|
|
|
|
func (f EntryOptionFunc) applyToEntry(e *ent.KVEntryCreate) {
|
|
f(e)
|
|
}
|
|
|
|
func WithTTL(ttl time.Duration) EntryOption {
|
|
return EntryOptionFunc(func(e *ent.KVEntryCreate) {
|
|
e.SetTTL(time.Now().UTC().Add(ttl))
|
|
})
|
|
}
|