drone-email/pkg/domain/build.go
Markus Pesch daf58bb4ca
All checks were successful
continuous-integration/drone/push Build is passing
Initial Commit
2022-07-24 20:33:39 +02:00

34 lines
680 B
Go

package domain
import "time"
type Build struct {
Created int64
Event string
Finished int64
Link string
Number int
Started int64
Status string
}
func (b *Build) CreatedToTimeFormat(format string) string {
return time.Unix(b.Created, 0).Format(format)
}
func (b *Build) FinishedToTimeFormat(format string) string {
return time.Unix(b.Finished, 0).Format(format)
}
func (b *Build) IsEvent(expectedEvent string) bool {
return expectedEvent == b.Event
}
func (b *Build) IsStatus(expectedStatus string) bool {
return expectedStatus == b.Status
}
func (b *Build) StartedToTimeFormat(format string) string {
return time.Unix(b.Started, 0).Format(format)
}