feat(backend): impl share expiry update

This commit is contained in:
2025-12-28 19:01:53 +00:00
parent 67320f8090
commit e3d78497e8
3 changed files with 123 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
package nullable
import (
"bytes"
"encoding/json"
"time"
)
// Time tracks whether a JSON field was set and stores an optional time value.
type Time struct {
Time *time.Time
Set bool
}
func (nt *Time) UnmarshalJSON(b []byte) error {
nt.Set = true
if bytes.Equal(bytes.TrimSpace(b), []byte("null")) {
nt.Time = nil
return nil
}
var t time.Time
if err := json.Unmarshal(b, &t); err != nil {
return err
}
nt.Time = &t
return nil
}