LastDate returns the date of the last snapshot for the asset with the given name.
(name string)
| 150 | |
| 151 | // LastDate returns the date of the last snapshot for the asset with the given name. |
| 152 | func (s *SQLRepository) LastDate(name string) (time.Time, error) { |
| 153 | row := s.lastDateQuery.QueryRow(name) |
| 154 | |
| 155 | var date time.Time |
| 156 | |
| 157 | err := row.Scan(&date) |
| 158 | if err != nil { |
| 159 | if err == sql.ErrNoRows { |
| 160 | return date, fmt.Errorf("unable to find asset") |
| 161 | } |
| 162 | |
| 163 | return date, fmt.Errorf("unable to get the last date: %w", err) |
| 164 | } |
| 165 | |
| 166 | return date, nil |
| 167 | } |
| 168 | |
| 169 | // Append adds the given snapshots to the asset with the given name. |
| 170 | func (s *SQLRepository) Append(name string, snapshots <-chan *Snapshot) error { |
no outgoing calls