Handle zip file modification (#877)

* Rescan zip if updating mod time
* Use inequality for mod time comparison
* Add sort by file_mod_time (fixes #469)
This commit is contained in:
WithoutPants
2020-11-05 10:26:51 +11:00
committed by GitHub
parent 9ec762ae9a
commit 5f482b7b8a
20 changed files with 612 additions and 163 deletions

View File

@@ -19,3 +19,31 @@ func (t *SQLiteTimestamp) Scan(value interface{}) error {
func (t SQLiteTimestamp) Value() (driver.Value, error) {
return t.Timestamp.Format(time.RFC3339), nil
}
type NullSQLiteTimestamp struct {
Timestamp time.Time
Valid bool
}
// Scan implements the Scanner interface.
func (t *NullSQLiteTimestamp) Scan(value interface{}) error {
var ok bool
t.Timestamp, ok = value.(time.Time)
if !ok {
t.Timestamp = time.Time{}
t.Valid = false
return nil
}
t.Valid = true
return nil
}
// Value implements the driver Valuer interface.
func (t NullSQLiteTimestamp) Value() (driver.Value, error) {
if t.Timestamp.IsZero() {
return nil, nil
}
return t.Timestamp.Format(time.RFC3339), nil
}