Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dhananjaykrutika committed Oct 28, 2024
1 parent fbc0f57 commit 55f722b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions pkg/lifecycle/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,21 +441,18 @@ type AllVersionsExpiration struct {
DeleteMarker ExpireDeleteMarker `xml:"DeleteMarker,omitempty" json:"DeleteMarker,omitempty"`
}

// IsDaysNull returns true if days field is null
func (e AllVersionsExpiration) IsDaysNull() bool {
return e.Days == 0
}

// IsNull returns true if days field is 0
func (e AllVersionsExpiration) IsNull() bool {
return e.IsDaysNull()
return e.Days == 0
}

func (ave AllVersionsExpiration) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
if ave.IsNull() {
// MarshalXML satisfies xml.Marshaler to provide custom encoding
func (e AllVersionsExpiration) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
if e.IsNull() {
return nil
}
type allVersionsExp AllVersionsExpiration
return enc.EncodeElement(allVersionsExp(ave), start)
return enc.EncodeElement(allVersionsExp(e), start)
}

// MarshalJSON customizes json encoding by omitting empty values
Expand Down

0 comments on commit 55f722b

Please sign in to comment.