From 1a7622bfa6c84496a6edb4743e5c0cf64719c548 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Sat, 1 May 2021 17:35:18 -0400 Subject: [PATCH] loglist: add some helper functions --- loglist/schema.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/loglist/schema.go b/loglist/schema.go index 06c7315..a5aa317 100644 --- a/loglist/schema.go +++ b/loglist/schema.go @@ -71,6 +71,14 @@ type State struct { } `json:"rejected"` } +func (state *State) IsApproved() bool { + return state.Qualified != nil || state.Usable != nil || state.Readonly != nil +} + +func (state *State) WasApprovedAt(t time.Time) bool { + return state.Retired != nil && t.Before(state.Retired.Timestamp) +} + type LogType string const (