Files
RenewCMS/internal/infrastructure/useCases/RecordRunningInfo.go
T

22 lines
585 B
Go

package useCases
import (
"RenewCMS/internal/domain/update"
"time"
)
type RecordRunningInfoUseCase struct {
store update.RunningInfoStore
version string
pid int
now func() time.Time
}
func NewRecordRunningInfoUseCase(store update.RunningInfoStore, version string, pid int, now func() time.Time) *RecordRunningInfoUseCase {
return &RecordRunningInfoUseCase{store: store, version: version, pid: pid, now: now}
}
func (r *RecordRunningInfoUseCase) Record() error {
return r.store.Write(update.RunningInfo{Version: r.version, Pid: r.pid, StartedAt: r.now().UTC()})
}