fix: new test and extract time.Now to mockable Clock #181
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 48s
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 48s
This commit is contained in:
17
service/clock.go
Normal file
17
service/clock.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package service
|
||||
|
||||
import "time"
|
||||
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
}
|
||||
|
||||
type ClockImpl struct{}
|
||||
|
||||
func NewClockImpl() Clock {
|
||||
return &ClockImpl{}
|
||||
}
|
||||
|
||||
func (c *ClockImpl) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
Reference in New Issue
Block a user