Compare commits

...

2 Commits

Author SHA1 Message Date
Arnaud Delcasse 30a3d18277 fix
Build and Push Docker Image / build_and_push (push) Failing after 26s Details
2025-04-29 10:21:00 +02:00
Arnaud Delcasse 4b6de48764 fix 2025-04-29 10:15:08 +02:00
1 changed files with 13 additions and 10 deletions

View File

@ -12,14 +12,19 @@ import (
type OCSSTime time.Time type OCSSTime time.Time
func (t *OCSSTime) MarshalJSON() ([]byte, error) { func (t OCSSTime) MarshalJSON() ([]byte, error) {
// do your serializing here // do your serializing here
stamp := fmt.Sprintf("%v", time.Time(*t).Unix()) stamp := fmt.Sprintf("%v", time.Time(t).Unix())
return []byte(stamp), nil return []byte(stamp), nil
} }
func (v *OCSSTime) MarshalBSONValue() (bsontype.Type, []byte, error) { func (v OCSSTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
return bson.MarshalValue(time.Time(*v)) return bson.MarshalValue(time.Time(v))
}
func (t OCSSTime) ToTime() time.Time {
time := time.Time(t)
return time
} }
func (t *OCSSTime) UnmarshalJSON(b []byte) error { func (t *OCSSTime) UnmarshalJSON(b []byte) error {
@ -51,11 +56,9 @@ func (t *OCSSTime) UnmarshalBSONValue(bt bsontype.Type, b []byte) error {
return nil return nil
} }
func (t *OCSSTime) ToTime() *time.Time { func (t *OCSSTime) Format(format string) string {
if t == nil { if format == "" {
return nil return ""
} }
return t.ToTime().Format(format)
time := time.Time(*t)
return &time
} }