drone-email/pkg/domain/build.go

34 lines
680 B
Go
Raw Normal View History

2022-06-27 19:42:59 +00:00
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)
}